gcjx is a moderately-sized C++ program, 73,000 lines as counted by
wc. On this machine, even when taking advantage of g++’s
precompiled header feature, it takes 14 minutes to build.
By way of contrast, using jikes to build the 900,000 lines of java
code in Classpath takes 15 seconds on the same machine.
Now, in some ways this is not a fair comparison. Although I
compiled gcjx with
-g and thus avoided many
optimizations, it is still more expensive to generate object code than
bytecode. Also, as plenty of people will tell you, C++ is a more
expressive language than Java, and so you should expect to pay for
that. Nevertheless we’re talking about a more than 650x slowdown for
For me there is no question: the added power of C++ does not come
close to compensating for the time spent waiting for my builds to
complete. Some changes will introduce a 10 minute bubble into my
workflow — this has a noticeable effect on my concentration.
On the other hand, when working on Classpath and Mauve in Eclipse,
my changes are essentially ready immediately. For the last buglet I
worked on, I would simply work on the code in Classpath, or the test
case in Mauve, save my changes, and then, without pausing, switch
windows and run jamvm on the test.
I’m not really familiar enough with other C++ compilers on other
platforms to know where the fault for this lies — maybe other
compilers are a lot faster than g++. Though once you fix g++ you also
have to look at the linker, which seems to be another big time waster.
Naturally, tool performance is just one part of the whole
productivity story. That said, fast tools matter a lot, a lot more
than I used to think.