Why does Delphi's compilation speed degrade the longer it's open, and what can I do about it?
If you build your application, here are some tricks to speed up the process:
- Erase all *.dcu before the build (
del *.dcu /s
); - Run a good defragmenter on your corresponding hard drive;
- Put most of your source files in the same directory, and try to leave the IDE and Project library paths as short as possible, with the most used entries at first;
- Install DelphiSpeedUp.
Delphi 2007 should compile faster than Delphi 2006.
Delphi 2009/2010/XE would probably be slower: from user experiment, the implementation of generics and new RTTI made the compilation process more complex, and the actual implementation was found out to be slower e.g. than with Delphi 2007.
Update:
Did you try enabling the ProjectClearUnitCacheItem hidden menu entry?
I've this entry enabled either by the CnPack, either by DDevExtension (I don't know which one do this, probably the later). This could be used to clear the internal unit cache.
The gradual performance degradation could be due to some sort of memory leak or other bug in the compiler. Heaven knows D2005 and D2006 had enough of them! If you can't upgrade to a Unicode-enabled version of Delphi, you ought to at least update to D2007 (which I believe is still available from Embarcadero) for better stability.
Also, as Robert Frank mentioned in a comment, check out Andreas Hausladen's tools. Just a few days ago he released a patch that improves compilation speed quite a bit. Unfortunately, that specific feature is apparently only for D2009 and later, but a lot of his fixes help speed various things up, including the compiler.
It's well worth trying DelphiSpeedUp from Andreas Hausladen but that will only help IDE performance rather than compilation as I understand it.
The other idea that nobody has suggested yet is to use high spec solid state disks.
I recommend using 64 bit Windows 7 with a large amount of RAM for the best file caching performance.
Just be thankful your project isn't written in C++!