See how Delphi compiles very huge source file!

The test environment:
Hardware: really poor. Pentium 4, maybe 2.4G HZ? Don't know. It's at least 3 or 4 years old! The RAM is 1G.
Software: Delphi 7, I use the command line tool dcc32 to do the compile. OS is Win2000, with some memory consuming program running, such like MS Outlook, Eclipse, etc.

The test project:
A project with a major source file names TestCase.pas.
TestCase.pas has 121263 (120K) lines of code, and the file size is more amazing, 62,570,543 bytes (59.6M). You can see the average line length is about 500 characters, it's very long.

The content of TestCase.pas:
That file is major generated by a Perl script, which is used to test my another project. It mainly includes various function (global and instance functions) with different count of parameters.
The parameter count range is from 0 to 999. Note, the maximum parameter count is 999, so a lot! All of the parameters type is Integer, no strange parameters such like Variant are used.
Each function is in 3 calling conventions (Delphi register call, stdcall, and C++ cdecl) and in two versions, one is global function, another is object function (class member).
So there are around 1000 * 3 * 2 = 6000 functions in that source file. Also they are a lot of functions.

The test result:
The message reported by dcc32 is,
TestCase.pas(121263)
other trivial files
125579 lines, 1019.62 seconds, 16292320 bytes code, 70269 bytes data.

And here is some other data: the file size of TestCase.dcu is around 35M, the destination exe file size is around 16M.

The result is amazing according to following points:
1, Delphi can handle so large source file. I suspect (but not verify) many compilers can't process a source file with 60M size or 120K lines of code.

2, Delphi can compile crazy functions with 999 parameters. In the real life, no one will write a function with so many parameters, but at least it's proving Delphi's capability. 9999 parameters are also OK. 99999 parameters cause dcc32 crash, but who cares! Nobody needs a function with more than 10K parameters.

3, The exe compiled by Delphi works quite OK. So the huge file doesn't drive Delphi crazy. :-)

4, The peak memory used by dcc32 is about 250M. It's not so much considering a 60M source file.

5, The compiling time is amazing. 1000 seconds is only about 16 minutes, it's really fast enough. I expect a C++ compiler may need several hours to compile that huge file.

Conclusion:
Though this test is only a derived work of testing my another project, we have already seen the capability of processing huge source files in Delphi. It's amazing, and great!
SDL
Posts: 3
Comment
Another interesting thing
Reply #3 on : Fri November 04, 2011, 13:23:52
If you compile a project with thousands of units spanning thousands of directories, is much better to specify them in the ".dpr" file than specify them in the search path. Delphi tries to find each file in every search path directory multiple times during compilation, and it doesn't remember where the file is between compilations.
Qi
Posts: 3
Comment
Re: Later versions
Reply #2 on : Mon December 01, 2008, 01:12:47
Hi, Ulf,

No, I didn't test with any other version of Delphi.
I may try to test it with D2007 when I have time, but I have no any newer version than D2007.
Ulf Axelsson
Posts: 3
Comment
Later versions
Reply #1 on : Thu November 27, 2008, 11:03:52
Interesting statistics. Have you tested with any later version of Delphi to see if there is any change in speed/size?

/Ulf

Write a comment

  • Required fields are marked with *
  • Security Code is case sensitive, 'A' is different with 'a'.

If you have trouble reading the code, click on the code itself to generate a new random code.
Security Code: