[fpc-devel] Comparison FPC 2.2 - Delphi 7

Marco van de Voort marcov at stack.nl
Thu Jul 5 09:22:36 CEST 2007

> On Thu, 5 Jul 2007, Yury Sidorov wrote:
> > 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.

Afaik Delphi beyond 1 was never written in Assembler, but C++. TP (and thus
maybe D1) were in assembler.

And IMHO the portability argument is bogus without research. I have some
real doubts that this is the issue, since nearly all of the key parameters
(memory manager, system requirements) are the same.

I rather expect a problem in ppu searching and loading etc.

> 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.

Yes. But that accounts for maybe 10-40%, at best.
> 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.

That's what I suspect too, also we have by default a way larger number of
search directories, and we search for .inc files too. 

But that is just a hunch. Afaik there is simply no real data (except maybe
in Peter's head, since he afaik did the most recent profiling when he
implemented the internal linker).

So we can be short about this issue: want to improve? Start measuring, the
compiler is just a bloody pascal program.
> 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.

I had problems with the delphi compiler too, but only in odd ball projects
(activex components and the like). Not in plain pascal code.

More information about the fpc-devel mailing list