CodeGear

You are currently browsing articles tagged CodeGear.

I was helping a customer to migrate from Delphi 5 to Delphi 2006 for some time ago.

It was almost only to reopen and compile the project except for some minor changes. We had to add a few units (i.e. variants) to the uses clause here and there and fiddle with conditional defines in a few places to get it to compile with both D5 and D2006. A third party component was not a backward compatible as you cold wish but in general the major work was done in less than a day.

But there where one big issue that we had to address first. The size of the project was about a few hundred forms and half a million lines of code. It took 90 minutes to compile in D5 and even longer in D2006. What is going on here? Ninety minutes for half a million lines of code is not the speed of the lightning fast Pascal compiler as I know it!

After analyzing the code I found that there was a general pattern of including a lot of units in the uses-clause in every unit. It appeared that this crisscross of references had a non-linear time complexity on the compiler. The only way to fix it immediately was to remove as many units as you can from the uses-clause in the interface section or move them to the implementation section. I imagined a nightmare of daunting manual work…

In the end the recipe to fix this was rather simple. It involves some free tools and open source tools but it does the job automatic. And the result was a rather successful optimization. We reduced compiled time from 90 minutes to 50 seconds – over 100 times! And the linker could remove 100.000 lines of unused code. I was pretty pleased with myself that evening. :-)

Ingredients

  • ICARUS – a free tool from the maker of Pascal Analyzer. 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 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.

Tags: ,

The Developer Tools Group is growing; I’m new in the role as Evangelist in the Nordic Countries. It feels good and all nine of us DevCo guys in the Stockholm office are excited.

Part of my job is to stay in touch with You, the Developer Community in Finland, Denmark, Norway and Sweden. Keep you updated and feedback your suggestion and ideas to the guys at Engineering.


Skriv gärna en rad och berätta att du finns och vad du gör. Vi hörs!Minä en puhu suomea mikä jo varmaankin herätti huomiosi, ja sehän oli tarkoituskin. Olen uusi tässä DevCo “Evankelista” rollissa ja haluaisin mielelläni päästä yhteyteen kaikkien pohjoismaalaisten kanssa jotka käyttävät meidän tuotteitamme. Kirjoita muutamalla rivillä itsestäsi ja kerro mitä teet. Pidetään yhteyttä!


Click Contact in the menu to send me a private mail! – Don’t forget your own e-mail address otherwise I can not get back to you ;-) /Fredrik

Tags: ,

Newer entries »