[fpc-pascal] Speed difference between intel/ppc on intel Mac

Jonas Maebe jonas.maebe at elis.ugent.be
Sat Sep 6 12:36:20 CEST 2008


On 05 Sep 2008, at 20:07, Tom Verhoeff wrote:

> I have an Intel-based MacBook Pro.  Until recently, I still used
> a PowerPC version of FPC.  PowerPC code on this machine runs through
> (invisible) emulation.
>
> However, I upgraded now to FPC 2.2.2 for Intel on mac.
> And to my surprise one of my time-consuming apps is twice slower,
> instead of faster.  The PowerPC version took 95 minutes, the
> Intel version takes 195 minutes.  This is on exactly the same machine,
> some OS.
>
> It could be a compiler options issue.  But I tried to compile the
> Intel version for fastest code (no checking, etc.).

Even if you'd compile an Intel version without any optimisations, it  
will normally be faster than the most optimised PPC version. One thing  
that may be happening here is however that because your program runs  
for such a long time, the dynamic optimiser in the PPC emulator is  
able to optimise the code so well that it actually becomes faster than  
the best that a static compiler could ever do. This sort of program,  
especially if its computation kernel is not too large, is an ideal  
candidate for run time optimisation.

Another possibility is that the computation kernel is fairly small and  
that the register allocator of the emulator does a better job with  
register allocation than FPC's register allocator (how many values you  
can keep in registers in inner loops can make quite big differences in  
execution speed).

> Is there a way to see what options fpc actually uses (i.e.
> to find out which options are in effect, e.g. useful when both
> configuration file and command line options are being used)?

You can use -vd to have the compiler print out all compiler options it  
interprets (both from configuration files and from the command line).  
In general, to get the best code for an Intel Core family processor,  
use something like

-O3ppentium4 -Cppentium4 -Cfsse2

i doubt it'll speed up your program by a factor of 2 in any case though.


Jonas



More information about the fpc-pascal mailing list