8 Jun 2009 wingo   » (Master)

hospitalized for approaching perfection

My god, June, June must be the most amazing month of the year. Things are green, and the awareness is palpable that summertime is here, in the street, at the bars, at the beach -- this is the time that is not the other time.

June is when strange and wonderful things happen. My sister, who lives in DC, called the other day to say she'd be here in Barcelona this weekend. Just on Sunday I was walking to the park and ran into an old friend I hadn't seen since 2000. June is the month of picnics: of picnics on the Seine, of picnics in the park, of picnics on the beach, of barbecues on terraces. June is for bare feet and open windows. June is for fireworks and music in the street.

hack

And yet, I hack, so much. I'm growing a little concerned, to be honest -- but now more than ever I feel like I'm doing my best work, and so I continue. It might be an illness.

In case you're new here, I've been hacking on Guile, an implementation of Scheme. Since my last dispatch, I landed a branch to Guile master that brings psyntax to the heart of Guile, as the default expander.

This was actually quite a feat, given the module hygiene work I wrote about earlier -- because how do you have an expander that understands modules and hygiene, before modules themselves have booted up? Anyway, it works now :)

For users, the practical implication of this is that syntax-rules and syntax-case are available, all the time. This is a lovely, lovely thing.

However, running the expander works against the most important performance hack of Guile 1.8: the memoizer. When you load a module, Guile 1.8 reads everything, but only does the minimum amount of work. For example, once it sees a procedure, it doesn't process the body of the procedure until the procedure is called. This reflects the reality that only a fraction of code is ever called, and was a big win for Guile 1.8.

But in Guile 1.9 / 2.0, we lose this advantage, as the expander does traverse all code. Of course, if your code is compiled already, it needs no expansion so loading is very very fast, but Guile has a lot of users and existing code out there, and I don't think they'd be particularly pleased if an upgraded touted to speed up their programs actually slowed them down.

So, for that reason, I hacked in some automatic compilation support, and turned it on by default. The upshot is that if Guile sees a file for which it can't find a corresponding compiled version, or the compiled version is out of date, it will compile it then and there -- and stash away the result, so it will be found the next time.

Of course, figuring out how to find the compiled files, and where to put the cache, but how to keep supporting shared installed architecture-specific compiled files, and how to cope with lack of permissions to write the compiled files, or errors in compilation -- you know, it's like Steve's legalizing marijuana. The devil's in the details. Hopefully I have things ironed out now, though. After all, if Python can do it...

Historically, expanding Guile Scheme with psyntax has had a couple more problems, though: the original variable names would be lost, due to the alpha renaming I discussed before; and, you lose source location information, so you don't know where backtraces come from. Through a stroke of luck and wine-induced hubris (thanks Ángel!), I did manage to plumb that information through, which is really pleasing.

(If you're still with me, I understand you are a programming languages enthusiast. Well to you I say: be wary of the verb "plumb". It suggests something shitty either about software of the process of making it. But I am willing to describe my interactions with psyntax as, indeed, shitty.)

(Continuing the parenthesis though -- are there not those that have a Freudian delight in shit? Whenever I hack psyntax I do feel better afterwards. It's a strange powerful relieved feeling.)

...

Perhaps the most relevant update from the last month in Guile is that we fixed a 2.0 release date, on the 15th of October; and we'll be releasing monthly until then, starting on the 19th of this month.

Also, Guile is finally joining the Unicode-speaking world, thanks to Ludovic Courtès and Mike Gran. We're using the little-known libunistring to do the heavy lifting; if there are packagers out in the audience, let this be my call to you to package this for your distros. It's by Bruno Haible, really well-done, and has been in Gnulib for a while now. It's time for it to go to distros.

Anyway, enough blathering for this Monday night. I was prompted into this by a fit of despair, looking again at the Waddell/Dybvig inlining algorithm. Perhaps after a more composed encounter with that paper, I'll have some novelties for the ether. Until then, happy hacking!

Syndicated 2009-06-08 21:30:05 from wingolog

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!