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

后端 未结 6 1240
南方客
南方客 2021-02-01 14:20

My company has been running a large project on Delphi for more than a decade. Our codebase has been growing over the years and now stands at around 4 million lines of code. Comp

相关标签:
6条回答
  • 2021-02-01 14:44

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

    0 讨论(0)
  • 2021-02-01 14:47

    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.

    0 讨论(0)
  • 2021-02-01 14:48

    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.

    0 讨论(0)
  • 2021-02-01 14:59

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

    0 讨论(0)
  • 2021-02-01 15:00

    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.

    0 讨论(0)
  • 2021-02-01 15:05

    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?

    Clear Unit Cache 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.

    0 讨论(0)
提交回复
热议问题