Saturday, July 08, 2006


EiffelStudio Precompiled Libraries

Day-to-day compiling in EiffelStudio (known as melting) is very quick, but doing a full rebuild of a project (a freeze or a finalize) is very slow compared with a lot of other programming languages.

If the project uses a lot of big libraries like gobo or vision2, then it's unbearably slow.

Some months after I started using EiffelStudio 5.5, I discovered that I could speed up my builds by making my own precompiled libraries. I had been using the precompiled libraries (base, wel and vision2) that are part of the EiffelStudio installation. Making my own precompiled library that included many of the gobo clusters sped the builds up significantly. This remained true when I upgraded to EiffelStudio 5.6.

Back then, I was building .NET Eiffel projects. These days I'm building classic Eiffel projects on Windows. Naturally, having learned the benefits of precompiled libraries, I did the same as I had done on the earlier project.

I was disappointed, though, to find that my eleven projects continued taking about thirty minutes to build, despite using proecompiled libraries. As well as adding gobo, I added some of our own more stable clusters to a precompiled library. It didn't help.

So I did some timings, with different sets of precompiled libraries, of how long it took to finalize and then finish freezing the eleven projects.
The builds were all done at the command line with EiffelStudio 5.6.1218 and Microsoft C/C++ 14.00.50727.42 32-bit for 80x86:

ec -batch -ace file -project_path path -finalize -keep -c_compile
finish_freezing -silent

ProjectBuild ABuild BBuild C
precompiled libs4m 23s4m 16snil
app 14m 06s4m 23s4m 49s
app 23m 59s4m 50s3m 52s
app 31m 57s2m 00s1m 57s
app 42m 25s2m 32s2m 56s
app 53m 03s1m 36s2m 03s
app 62m 38s2m 29s2m 52s
app 72m 53s2m 37s2m 58s
app 82m 37s2m 12s2m 41s
app 92m 32s2m 14s2m 48s
app 102m 43s2m 19s2m 50s
app 112m 46s2m 19s2m 47s
TOTAL for apps30m 39s29m 31s32m 33s

So precompiling my classic EiffelStudio projects on Windows saved me 3 minutes (about 10%). Build B (the precompiled base+time+gobo+wel) performed best. I would have to re-run these tests to be sure that there wasn't some other factor coming into play, but I was careful to leave the computer alone whilst it ran each build.

Not using precompiled libraries adds a lot to the time spent doing C compilation and linking. There must be a big saving in the earlier Eiffel compilation stages to compensate for this, especially considering that the C compilation is being done twice (once to finalize, and again to finish freezing).

Also note that, if you take into account that building the precompiled libraries took more than 4 minutes in both cases, not precompiling is actually 1 or 2 minutes faster! The fallacy in this argument is that precompiling is done only once, of course.

Based on these timings, I would be happy not to use precompiled libraries at all if there is a compelling reason not to.

Is executable size a compelling reason? I don't care about exe size these days -- we can afford to waste a few megabytes, and 10 Mb exes seem to load instantly -- but it's interesting to note that the exes from Build C (without precompiled libraries) add up to 58,744,832 bytes; whereas Build B adds up to 66,150,400 bytes. For now, we're sticking with Build B.

Isn't your C compiler the biggest factor? I've read some post on people using Tiny C for example and getting incredible speeds.

I've tried TinyC but had problems linking to eposix libraries so haven't used it myself.
Hi Berend.

If I don't use precompiled libraries, then C compilation takes about 50% of the total compilation time (with Microsoft C).

If I do use precompiled libraries, then the C compilation time drops dramatically, but the Eiffel compilation time increases.

Your TinyC suggestion sounds like it might be worth investigating.
On the one hand, using Eiffel .Net avoids a lot of the C compilation. The compiler generates IL directly for the managed code and only generates C code to handle the unmanaged bits.

On the other hand, I've not yet been able to use any of the 5.7 Betas to compile any of my Eiffel .Net apps. Nor have I had much luck building precompiled libraries for .Net.
Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?