Why does Delphi's compilation speed degrade the longer it's open, and what can I do about it?

三世轮回 提交于 2019-12-02 19:58:50
Arnaud Bouchez

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++!

Consider building with runtime packages in-house, then building monolithic executables when sending code to a QA department or distributing your application.

This requires extra maintenance, but the dramatic increases in build times are worth it IMO.

We have a 2.4 MLOC project with about 40-50 smaller, supporting applications. When compiled against a group of runtime packages the project builds in about 500K lines and builds about 6 times faster (15 seconds vs. 90 seconds). Many of the smaller applications compile in one second or less because so much of the packaged code is shared.

You need to be sure to test the monolithic executable, not the packaged executable. But generally you shouldn't see too many behavior differences if you follow good coding practices.

Fabricio Araujo

This question have some more advice to get better compilation speed. Avoiding circular references and detect unused units (with CnWizards) are of greater effect.

Did you try to compile the code using a script command line?

Did recompiling from command line made the process stand on 40 seconds?

run from cmd "dcc32.exe" to see usage.

Update: I can't check it now, however you should try compiling from command line and see if you try to run from the ide, the ide should not recompile, and lets you run with debug.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!