Long uses lists especially of units circularly referencing each other are killing for compiler performance both in CPU and memory consumption.
To solve it:
Ingredients
- ICARUS – a free tool from the maker of Pascal Analyzer. [WayBack] http://www.peganza.com/products.htm. Icarus parses Delphi or Borland Pascal source code and generates a Uses Report. This report will help you remove unneeded units from your uses lists. You will also know which units that can be moved from the interface uses list to the implementation uses list.
- Uses Cleanup Tool – by Oleg Zhukov [WayBack] http://cc.borland.com/Item.aspx?id=23199.
Step-by-step
- Run ICARUS on your delphi project to get a report of which units depends on each other.
- Input this report in the Uses Cleanup tool to automatically update all uses-clauses in your source code.
- Delete all DCU-files and recompile.
Source: [WayBack] Optimized Pascal compilation time | Fredrik Haglund’s blog
Edit
Bit-rot galore!: Since Fredrik published his article, some links have vanished, so they are invalid in the above quote as well:
- [WayBack] http://cc.borland.com/Item.aspx?id=23199 moved to [WayBack] http://cc.codegear.com:80/Item.aspx?id=23199 with a retracted item.
- [WayBack] http://www.peganza.com/products.htm is moved to [WayBack] https://www.peganza.com/products.html.
Uwe Raabe was the first to notice on [WayBack] G+ Long uses lists especially of units circularly referencing each other are killing for compiler performance both in CPU and memory consumption… – Jeroen Wiert Pluimers – Google+ that the Uses Cleanup Tool by Oleg Zhukov can now be downloaded from [WayBack] Files as [WayBack] UsesCleanupceaf.zip.
Several people suggest using cnPack in the above G+ thread, but [WayBack] their Delphi parser is far behind [WayBack] Delphi AST.
Cleaning uses lists is a tough thing, it very much depends in getting the dependencies really right, then interpreting them correctly.
–jeroen