[arch-general] CONFIG_CC_OPTIMIZE_FOR_SIZE is not set

Damjan Georgievski gdamjan at gmail.com
Thu Oct 22 19:23:24 EDT 2009


>> 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


More information about the arch-general mailing list