Note that there are some explanatory texts on larger screens.

plurals
  1. PODelphi: How to organize source code to increase compiler performance?
    primarykey
    data
    text
    <p>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 sometimes much more longer so that it is quicker to terminate Delphi, erase all dcu files and recompile everything.</p> <p>Does anyone know a way to identify, what makes the compiler slower and slower? Any tips how to organize the code to improve compiler performance?</p> <p>I have already tried following things:</p> <ul> <li>Explicitly include most of the units in the dpr instead of relying on the search path: It didn't improve anything.</li> <li>Use the command line compiler dcc32: it isn't faster.</li> <li>Try to see what the compiler does (using ProcessExplorer from SysInternals): apparently it runs most of the time a function called 'KibitzGetOverloads'. But I can't do anything with this information...</li> </ul> <p><strong>EDIT, Summary of the answers until now:</strong></p> <p>The answer that worked best in my case:</p> <ul> <li>The function "Clean unused units references" from <a href="http://www.cnpack.org/index.php?lang=en" rel="noreferrer">cnpack</a>. It almost automatically cleaned more than 1000 references, making a "cold" compilation about twice faster. ("cold" compilation = erase all dcu files before compiling). <em>It gets the reference list from the compiler. So if you have some {$IFDEF } check that all your configurations still compile.</em></li> </ul> <p>The next thing I would like to try:</p> <ul> <li>Refactoring the unit references manually (eventually using an abstract class) but it is much more work, since I first need to identify where the problems are. Some tools that might help: <ul> <li><a href="http://www.gexperts.org/" rel="noreferrer">GExperts</a> adds a project dependencies browser to the delphi IDE (but unfortunately it can not show the size of each branch)</li> <li><a href="http://cc.embarcadero.com/Item/19441" rel="noreferrer">Delphi Unit Dependency Viewer V1.0</a> do about the same thing but without Delphi. It can calculate some simple statistics (Which units is the most referenced, ...)</li> <li><a href="http://www.peganza.com/products.htm" rel="noreferrer">Icarus</a> which is referenced on <a href="http://blog.fredrikhaglund.se/blog/2006/07/03/optimized-pascal-compilation-time/" rel="noreferrer">a link</a> in one of the answer.</li> </ul></li> </ul> <p>Things that didn't change anything in my case:</p> <ul> <li>Putting every files from my program and all components in one folder without subfolders.</li> <li>Defragmenting the disk (I tried with a ramdisk)</li> <li>Using a ramdisk for the code source and output folders.</li> <li>Turning off the live scanning antivirus</li> <li>Listing all the units in the dpr file instead of relying on the search path.</li> <li>Using the command line compiler dcc32 or ecc32.</li> </ul> <p>Things that didn't apply to my case:</p> <ul> <li>Avoiding having dependencies on network shares.</li> <li>Using <a href="http://andy.jgknet.de/blog/?page%5Fid=8" rel="noreferrer">DelphiSpeedUp</a>, because I already had it.</li> <li>Using a single folder for all dcu (I always do it)</li> </ul> <p>Things that I didn't try:</p> <ul> <li>Upgrading to another Delphi version.</li> <li>Using dcc32speed.exe</li> <li>Using a solid-state drive (I didn't tried it, but I tried with a ramdisk where I put all the source code. But maybe I should have installed delphi on the ramdisk too)</li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload