C++ noodling

A while back I spent a little time playing with g++, trying to understand compilation performance. For this experiment I tried to measure how much speedup a “model-based” compiler could expect to achieve.

I compiled my test program a few different ways. I timed compilation of a plain build (more or less a “make”) both with and without PCH. And, I timed compilation of the “all.cc” approach — I’ve heard many times over the years that C++ shops will cat their sources together into one big compilation unit, and that this reduces overall build times.

So far I’ve only done this experiment by compiling gcjx, a moderately sized, fairly ordinary, C++ program with which I am familiar. I plan to redo this with a couple other programs as well (send suggestions).

The results:

Approach Time
Plain build 13m50s
Plain + PCH 8m05s
all.cc 3m18s
all.cc + PCH 3m17s

This basically conforms with things I’ve found previously, but I was a little surprised that PCH is not a bigger win than it is, especially considering that I intentionally wrote gcjx with one big header file that includes most things, precisely to make better use of this feature. (I’ve heard from other folks that in some situations PCH is a net lose and they disable it. Any experiences out there?)

Anyway, I consider this promising data for a compile server approach, since what I’m thinking about essentially models the “all.cc” approach in the compiler.

GCC 4.2

GCC 4.2 was released a few days ago. Here’s the list of changes. Congratulations to everybody who worked on this, and especially to Mark Mitchell for once again doing the release engineering work.

Different parts of GCC evolve at different rates, and due to some quirks of timing, it turns out that the gcj parts of 4.2 are already obsolete. For Fedora we back-ported the 4.3 gcj bits to our base GCC release; I think the other distros are doing the same. Basically what happened is that all our Java 1.5 work came in after 4.2 had closed for major changes.

Post Java One

I’m back from Java One — what a crazy week!

I’m a bit wary of thanking people; there are many people deserving appreciation and I would hate to leave someone out. I suppose I must try, and bear the consequences. So, special thanks to Tom Marble, Onno Kluyt, Rich Sands, Mark Reinhold, Simon Phipps, and Bruno Souza — each of them made a special effort to include us free software hackers in the cool behind-the-scenes goings-on.

I was also happy to meet and talk to many people while there: Per Bothner, Chris Oliver, Casey Marshall (finally! But I’m sad to say there are still a few gcj developers I have not met), Glynn Foster (nice guy — I meant to meet him for a beer at this one party but failed), Jeff Bailey, David Daney, Ean Schussler (always fun!), Erinn Clark, Jacob Applebaum, Ian Taylor, Tom Baxter (long time no see!), Roland McGrath, David Herron, Peter Ahé, Andre Burgoyne, and Johanna Neaderhouser. Whew. Actually I was introduced to many more people (Eben Moglen, James Gosling, John Cage, Neal Gafter, … to drop some names) but the former are the folks I actually had conversations with. And, yes, it was as overwhelming as you might imagine, especially if you are essentially an introvert, as I am.

Java One

Java One is huge, much huger than I’d imagined. The opening keynote had a steady stream of corporate luminaries onstage to talk about their Java-related plans. Many thanks to Bruno for saving us some great seats — and also to Tom Marble for making the effort to include me in the various goings on.

The big news is that OpenJDK sources are available, and that Dalibor is on the initial OpenJDK governance board. Next step: replace the remaining binary blobs with free software.

Also today they announced a big new initiative around F3, which has been re-branded “Java FX Script”. Sun continues to surprise — this is a cool project but I did not expect such a big push for it. I met Chris Oliver today (interesting guy) and also saw Per Bothner; it turns out that Per works on F3 now, writing a compiler to turn F3 scripts into JVM bytecodes.

Tons more has happened, too much to write about really. I did want to mention that Sun has also impressed me with their environmental committments. I’ve heard several times how Sun servers are friendlier (my understanding is that this applies to the manufacturing process) then competing servers, and also there was some talk (though I lost a bit of context) about having the conference be carbon neutral.

Sleep is Optional

Saturday night Onno or Tom (Marble) or Rich told me that, at JavaOne, sleep is optional. Then we promptly set about trying to live the dream, staying up until far too late talking and wandering San Francisco — a great time being had by all, or at least me. I finally got to meet Casey Marshall in person. Also Tom invited Erinn Clark, who is super cool. She in turn brought her friend Jacob (didn’t catch his last name) who took us on a fascinating and occasionally uncomfortable tour of his workplace.

My schedule for this week is completely packed — not just with JavaOne sessions (counting the BOFs, activities run until 11pm every night) but also visits with friends and colleagues in the Bay Area. One of the downsides of working remotely is that, when you do get together with people, you not only end up wanting to talk extensively to everyone, but also you’re typically out of practice in doing so…

Java GUI Stuff

There seems to be some action in the Java GUI world right now. I was quite surprised by how many Swing talks there are at JavaOne.

AB5K is desktop widgets in Java, using JNLP — one of my favorite under-used technologies. The web site looks nice but they don’t seem to have many widgets yet. And widgets are so last year, har, har.

Chris Oliver’s F3 looks interesting. I’m considering seeing his talk at JavaOne next week… perhaps AB5K ought to be using this. He’s also posting JNLP links for his demos.

I tried both of these with netx and gcj, but netx is too old, and we don’t have Pack200, and … OpenJDK take me away.

Hot Fuzz

This documentary is a shocking expose of what is hidden behind the carefully crafted facade of English country villages.

While a bit gory at times it was hilarious — better than Shawn of the Dead. Of course, I loved Super Troopers, so calibrate your expectations accordingly.

Emacs 22

This weekend I upgraded to Emacs 22 from rawhide. This was painless — and thank goodness, since the new gnus updated my setup, so there is no going back. So far it looks awesome.

Gnus is noticeably faster. That alone was worth the upgrade.

Now that emacsclient supports --eval I went ahead and configured Mozilla to use Emacs for mailto: URLs — no more avoiding those. There’s a HOWTO here.

There’s a new image-viewing dired-like mode. That’s kind of silly but I imagine I will end up using it.

diary-from-outlook-gnus looks like a cute addition. There’s also some icalendar code in there. I don’t calendar much, and I doubt that anybody sends me outlook-formatted appointments. Too bad, really; machine-readable things like this are, one supposes, part of the basic promise of computers.

These are just a few random things I noticed… the NEWS file is 200k, and this is a major release. I haven’t really had an opportunity to use it in anger.

Emacs Update

I know you couldn’t possibly get bored by another Emacs post.

Emacs is really the one thing I come back to when I want to hack joyfully. Other things are interesting or relevant, but I find Emacs fun.

How could I have missed goto-address for so long? This command will buttonize URLs in a buffer; I enable it by default in change-log-mode, but I’m considering just enabling it globally. It isn’t perfect — it doesn’t recognize URLs as you type. But this is probably fairly easy to fix, and in the meantime it is still handy.

Second, my calendar (really appointment) code to use the notification area worked for the first time today. This is still a bit fragile, I don’t quite know what is going on. But, it does mean I am very close to not ever using Evolution. (Speaking of which I finally set things up so I can easily send email from my various personal accounts via Gnus. This was an incredible pain, involving writing elisp functions, etc. No wonder this stuff is so unpopular.)

I wrote a little hack over the weekend to emulate the Gnome sticky notes applet. This was pretty simple, a couple hundred lines of lisp. But, I didn’t like the result very much. Instead I think I am going to finally upgrade to Emacs 22 (which is something of a pain since I’m using some RPMs that aren’t updated) and use linkd, which looks pretty cool.

Work proceeds on package.el, but it isn’t quite ready for the next release.

I’ve been working steadily on project.el, a way to encapsulate project-specific settings in a simple data structure. The idea is, a project like GCC can publish a set of settings, and when you hack on that project, Emacs will automatically set the correct C style, correct new-file copyright template, correct tabs setting, etc. I’ve seen various projects do this already — they publish little .el files, usually bad ones, for their users. I really don’t understand why this functionality isn’t already in Emacs… right now everyone has to roll their own.