[fpc-pascal] optimised compiler options for "release" version

Jonas Maebe jonas.maebe at elis.ugent.be
Tue Jun 9 11:15:04 CEST 2009


On 09 Jun 2009, at 09:24, Graeme Geldenhuys wrote:

> leledumbo wrote:
>> AFAIK only -CfSSE? and -Op??? that you have to worry.

-Op??? is no problem. It's -Cp that can generate code which won't run  
on previous-generation cpus.

>> If you're not sure,
>> just use the lowest possible value (-CfX87 and -Op386). For  
>> optimizations,
>> even using -O3 is fine.
>
> Thanks. Do you know what exactly changes when you use various
> optimization options?  Is it primarily executable size or more speed
> related optimizations?

Speed (and also a bit of size, sometimes), but the effects will only  
be very minor in most cases. Only -Cfsse2 sometimes produces a  
noticable speedup on more recent processors.

> If it is speed related, how can I actually test the speed  
> differences so
> see by how much it increases?

Just time your program using the Unix "time" command (taking into  
account the fact that there will always be some amount of jitter).

> Does FPC have such tests available
> somewhere in the source code?


You can try Thomas Schatzl's cpu unit to time small code fragments: http://members.yline.com/~tom_at_work/index.html


Jonas



More information about the fpc-pascal mailing list