Re: gcc: why optimize for size flag is not the default

Поиск
Список
Период
Сортировка
От A.M.
Тема Re: gcc: why optimize for size flag is not the default
Дата
Msg-id EC649B6D-E52F-42EA-998F-40DD4D5024E1@themactionfaction.com
обсуждение исходный текст
Ответ на Re: gcc: why optimize for size flag is not the default  (Grzegorz Jaskiewicz <gj@pointblue.com.pl>)
Ответы Re: gcc: why optimize for size flag is not the default
Список pgsql-hackers
On Mar 11, 2009, at 3:18 PM, Grzegorz Jaskiewicz wrote:

>
> On 11 Mar 2009, at 13:51, Marko Kreen wrote:
>
>> Linux kernel is moving to use -Os everywhere.  AFAIK their argument  
>> is
>> that kernel code should not be doing anything CPU-intensive, thus
>> minimal cache usage is more important than unrolled loops.
>>
>> This also seems to hint that -Os is not really appropriate to  
>> Postgres.
>> Although it would be good fit for eg. PgBouncer.
>
> while it might be right in case of linux kernel (which I won't agree  
> totally with personally), I don't see any reason to compare it with  
> postgresql.
> Kernel is extensively use by everything in system, hence their  
> reasoning. Postgresql is an application.

MacOS X defaults to and recommends -Os with the rationales that  
smaller code causes less paging and less CPU instruction cache  
thrashing.

http://developer.apple.com/ReleaseNotes/DeveloperTools/RN-GCC3/index.html
For deployment builds, the recommended setting is -Os, which produces  
the smallest possible binary size. Generally, a binary that's smaller  
is also faster. That's because a large application spends much of its  
time paging its binary code in and out of memory. The smaller the  
binary, the less the application needs to page. For example, say a  
binary uses aggressive function inlining. That binary saves time with  
fewer function calls, but it could easily spend far more time paging  
the binary code containing those inlined functions in and out of memory.

-Os Optimize for size. -Os enables all -O2 optimizations that do not  
typically increase code size. It also performs further optimizations  
designed to reduce code size.

-Os is still "optimizing" but using a slightly different heuristic as  
to what "optimization" means.

That said, if postgresql is paging out, the DBA probably has  
postgresql or the server misconfigured.

Cheers,
M


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Grzegorz Jaskiewicz
Дата:
Сообщение: Re: gcc: why optimize for size flag is not the default
Следующее
От: Tom Lane
Дата:
Сообщение: Broken stuff in new dtrace probes