The Borland Delphi Object Pascal compiler is exceedingly fast as compared to typical C++ compilers. For instance, I have a program of about 40 556 lines of code as reported by the compiler. A complete build and link takes about 2-3 seconds on my machine - an AMD K62 750 with 256 Mb of Ram.

This is not only due to technical brilliance at Borland, but also because a typical line of Delphi code is easier for the compiler to read than an equivalent in C++ - there are no operator overloads, implicit cast operators, implicit copy constructors #defines, templates, Assign statements used as rvalues etc.

The code that is output is as fast, in some cases is said to be slightly faster then the equivalent program compiled in Borland C++. This is again because of the simpler code – the compiler has more opportunity for optimisation.

Of interest is that the complier version on the command line compiler – dcc32.exe, is incremented up from Turbo Pascal compilers. Here is a list of Complier versions. Note that Delphi 1 comes after Turbo Pascal 7

Ver80 (8.0) - Delphi 1
Ver90 (9.0) - Delphi 2
Ver93 (9.3) - used in Borland C++ Builder 1
Ver100 (10.0) - Delphi 3
Ver110 (11.0) - used in Borland C++ Builder 3
Ver120 (12.0) - Delphi 4
Ver125 (12.5) - used in Borland C++ Builder 4
Ver130 (13.0) - Delphi 5 and Borland C++ Builder 5
Ver140 (14.0) - Delphi 6
Ver150 (15.0) - Delphi 7

It is a common misconception that Pascal compilers speed is mostly due to simple parsing. At least at current CPU speeds (as in 100MHz+). In general even mere lexing is already more CPU bound than parsing.

The real reason is the module system that allows to store interfaces (headers) in binary form. Under C, tons of headers, usually significantly larger in size than the actual sourcecode are included.

Since under most Pascal dialects, preprocessor symbols don't import over compilation unit borders, a unit only needs to recompile if a dependant unit changes.

There is no reason why a precompiled header system for C/C++ couldn't come pretty close to e.g. Delphi in compilation speed, specially when conditional compilation based on symbols that cross header lines are avoided/discouraged

(so no

#define x

when y.h depends on x

Such a system is a lot more work though for a complex language (from a unit importing/exporting view) like C/C++

Log in or register to write something here or to contact authors.