Delphi: How to organize source code to increase compiler performance?

前端 未结 14 2185
一整个雨季
一整个雨季 2020-12-13 13:14

I\'m working on a large delphi 6 project with quite a lot of dependancies. It takes several minutes to compile the whole project. The recompilation after a few changes is so

14条回答
  •  鱼传尺愫
    2020-12-13 13:59

    A few years later I am struggling again with increasing compiling times. I am currently using Delphi XE4 and I am at a point where I absolutely need to refactor the units references. I thought about a new way to identify where are the problems:

    I’m using Process Monitor from Microsoft/SysInternals to monitor the compiler:

    1. I start Process Monitor with a filter to show only dcc32.exe (or bds.exe when working from the IDE).
    2. I build my project from the command line.
    3. At the end I look at the CreateFile operations in the log of Process Monitor.

    For each unit there will an entry for the .PAS file (when the compiler starts working on this unit) and one for the .DCU file (when the compiler is complexly done with this unit). By working on the log with a text editor and/or with Excel I can extract this kind of information:

    • A kind of “tree”, where you recursively see in which order the units have been compiled.
    • For each unit the delay between “.PAS file opened“ and “.DCU file written”.

    Then I try to interpret the results to find places where doing some refactoring would speed the compile time. It is not so easy, but I’m getting some encouraging results.

提交回复
热议问题