[fpc-pascal] Speed

Daniël Mantione daniel.mantione at freepascal.org
Wed Oct 31 00:16:50 CET 2007

Op Tue, 30 Oct 2007, schreef L:

> >   I think first code is faster than second, because in first code
> > SubCalculate function is in calling function body?
> Actually some times local scope functions are slower because the variables need
> to be carried around since you are doing somewhat of a lexical closure. The
> local scope function can have hidden variables being passed in since it needs to
> know about the parent function variables. So don't assume local scope is faster
> always. Assume it is slower, but do testing to verify. It could even be faster
> in some cases.. for example if you really do need to access all the variables in
> one place.
> >
> > P.S. Where i can read tips about writing fast FP code?
> I hear the Intel C compilers and Fortran compilers and Ada compilers are better
> optimized for certain things since FPC/delphi are generally desinged for GUI
> programming. ;-)

C/Fortran yes, Ada no; there exists no Intel Ada compiler. It is also 
false that FPC is slow because it has been designed for GUI programming, 
as that is plain false: FPC has been designed to exploit the performance 
of 32-bit processors: high performance, no memory limitations.

The compiler supports some features necessary for RAD (like rtti), and 
that is about everything you will find in FPC's design that is about GUI 
programming. Still, FPC is damned fine for GUI programming.

FPC has not been designed to exploit the performance of SIMD instruction 
sets, and this is exactly where commercial C and Fortran compilers get 
their performance.


More information about the fpc-pascal mailing list