The Power of Open Source

I have always enjoyed the speed of Delphi’s compiler.  It definitely sets Delphi apart from other native toolsets like Visual C++.  Over the last several weeks work on my latest project was grinding to a halt because for some reason the Delphi 7 compiler was taking any where from 3 to 3m22s to compile my project.

I’m sure many people out there would simply say “upgrade” to solve the problem.  That’s where it gets a little complicated.  I had evaluated Delphi 2010, and Delphi 2007 early on during project development.  The existing product version is in fact written with Delphi 2007, but I chose to use Delphi 7 instead.  Why?  In one word, CodeRush.  CodeRush is a very old product, but provides templating and refactoring support that is still beyond what is offered in the native IDE.  I’m also very comfortable with it.  The problem with “upgrading” is of course all the components used.  I have source for them, but migrating all of that, including design-time code can be rather onerous.

Besides, as a programmer, you need to find out why.  My other projects including hcOPF compile lightning fast as always.  So I contemplated what made this specific project so unusual.  Currently it only contains 64 units, uses the DevExpress grid suite (of course), the JCL/JVCL, hcOPF and a smattering of other small components.  One of the major differences was using the JCL/JVCL, and I know that it sucks in quite a large number of units the way it’s organized, but I still didn’t think that could be the cause.

I finally decided to post on the embarcadero newsgroups.  The Delphi community is still pretty vibrant, and there are lots of folks out there who have been using the product from day 1.  I got several suggestions including:

Put only .dcu, .dfm, .res, .inc file in the LIBRARY PATH, and .pas files only in the Browsing Path.

This did seem to help, but compilations were still about 3 minutes.

Then Marius suggested I look at Delphi SpeedUp.  I had ran across it earlier in my googling for performance improvements, but never considered it a solution to my problem because my performance problem was project specific.   Was I ever wrong!  Compilation times went from over 3 minutes to 11 seconds.

So this is the second time I must thank Andreas Hausladen; once for updating the JCL/JVCL to use the LIBSUFFIX directive to make it easier to manage my hcOPF packages for different Delphi versions, and now for Delphi SpeedUp.  Thanks also to the contributors to the FastCode project.

This just goes to show what Open Source can do for commercial products.  I think Embarcadero could leverage Open Source more effectively to build out the VCL, and improve the IDE.  Even the compiler could benefit from Open Source projects like LLVM.  Apple seems to have prospered by leveraging Open Source…

8 Responses to “The Power of Open Source”

  1. Anthony Frazier Says:

    There’s two things I can think of that lead to extremely long compile times:

    1. Units with the “read-only” attribute set.
    2. Large circular dependency groups, particularly if you put everything in the interface’s uses clause rather than the implementation uses clause.

  2. cjrh Says:

    With respect, I don’t think your story showed the benefits of open-source at all. Rather, it showed the benefits of having a Delphi guru around who gives software away for free. The resolution of your problem had absolutely nothing to do with the fact that the source-code for Delphi Speedup is available.

    The main benefit of open-source is that you can read the source. The strength of that is that as a developer, you can fix, modify or improve the source, and then share your improvements with others. The point of this is that everybody wins, and we can build on the work of each other. This is not to say that open-source is good, and closed-source bad: each has its place and to each it’s purpose.

    The title of your post is very misleading. For some weird reason, this is a topic (open-source) the Delphi community simply doesn’t grok like other programming communities. Perhaps it is because Delphi has been around a while longer than most. Sometimes one gets the strongest feeling that Delphi developers only see open-source as the latest fashion of “shareware”.

  3. Christian Wimmer Says:

    This could be a good reason to think about donations of any kind :)

  4. TPersistent.com » Blog Archive » Open Source Take 2 Says:

    [...] made some valid points about my last [...]

  5. Warren P. Says:

    @cjrh: Exactly!

    So WHERE did Open Source come in here?

    W

  6. Delphi: Optimizing extremely long compile times « The Wiert Corner – Jeroen Pluimers’ irregular stream of Wiert stuff Says:

    [...] Posted by jpluimers on 2010/04/26 Anthony Frazier mentions two very true paths for optimizing your Delphi compile times: [...]

  7. Delphi: Optimizing extremely long compile times « The Wiert Corner – Jeroen Pluimers’ irregular stream of Wiert stuff Says:

    [...] Posted by jpluimers on 2010/08/26 Anthony Frazier mentions two very true paths for optimizing your Delphi compile times: [...]

  8. Patrick Larsen Says:

    When it comes to avoiding unneeded units in uses clauses, I’ve found the free ICARUS tool from Peganza (www.peganza.com) to be of great help.
    Try it out and you will soon find that you use it over and over again.

Leave a Reply