[fpc-devel] Comparison FPC 2.2 - Delphi 7

Michael Van Canneyt michael at freepascal.org
Thu Jul 5 09:02:08 CEST 2007

On Thu, 5 Jul 2007, Yury Sidorov wrote:

> From: "Micha Nelissen" <micha at neli.hopto.org>
> > Jonas Maebe wrote:
> > > The main reduction in compile time would probably come from using -O-1
> > > -Ooregvar instead of -O2. I don't think the resulting code will be much
> > > slower either in most cases.
> >
> > No, the main reduction is not outputting anything to console: from 18.5
> > sec to 15.9 sec vs. 18.5 sec to 17.5 sec.
> >
> > I used 'compile-fpc | grep compiled'. Where compile-fpc is a batch file.
> I think it is because you run compilation for the second time and files were
> in cache.
> Here mu number for the second run without deletion of compiled unit files (to
> ensure that source files are cached):
> FPC with -O2: 14.7s;
> FPC with -O-: 11.4s;
> D7:            1.6s.
> Results are sad :( It is a good reason to find out why FPC is so slow even
> without optimizations. Linking time is less then 1s, so it is not slow.

Last I heard, the Delphi compiler is written in assembler, and is for 1 CPU only,
which means they can do a lot of optimizations. FPC has a more general architecture 
and therefore is not "optimal" in terms of speed.

Why do you think Borland has such a hard time supporting new platforms (provided
they spend time on it at all) ? They would have to rewrite their compiler practically 
from scratch. For FPC, adding a new CPU is not so much work, as it is designed for this.

So, the first reason that FPC is slower is its more general architecture. 
Speed is the price you pay for this.

A second reason for FPC being slower is that the compiler has to search 2-3 times
more files than Delphi (.ppu, .o - in several casings on linux etc). With windows 
being the slow animal that it is, this hits FPC hard.

And as for Delphi being fast - well, my daytime job projects require several
minutes for Delphi to crunch through them. I've had Delphi hang up on me more 
than once for 15 minutes on simple projects with complex dependencies...
All depends on what you throw at it. I haven't seen that happening with FPC yet.
It's slower, yes, but it's more consistent in it's slowness.


More information about the fpc-devel mailing list