Re: CONFIG_CC_OPTIMIZE_FOR_SIZE is not set

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



>> Optimizing for size sacrifices performance. Read the gcc
>> documentation about the -O{1,2,3,s} options.
>>
>
> I don't know if it is as simple as that. I recall reading somewhere that
> under certain circumstances a binary optimized with -Os is faster than a
> binary optimized with -O2.
>
> The reason for this is that a smaller binary may load faster than a big
> one and cause less page faults.

not page faults but the issue is about the CPU L1/L2 cache strain.

BTW,
the help entry says

| CONFIG_CC_OPTIMIZE_FOR_SIZE:
|  Enabling this option will pass "-Os" instead of "-O2" to gcc
|  resulting in a smaller kernel.
|  If unsure, say Y.

alsi Ingo Molnar says here http://lkml.org/lkml/2007/9/13/88 :

| also, if you want to maximize performance, it usually makes more sense
| to build with these flipped around:
|
|  # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
|  CONFIG_FORCED_INLINING=y
|
| i.e.:
|
|  CONFIG_CC_OPTIMIZE_FOR_SIZE=y
|  # CONFIG_FORCED_INLINING is not set
|
| because especially on modern x86 CPUs, smaller x86 code is faster. (and
| it also takes up less I-cache size)

-- 
damjan


[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux