Oct 2004

For the price of one ink cartridge

I can buy 7 gallons of motor oil.

Comments

New York, Sunday to Tuesday

Conrad, Felicity and I took an Amtrak train from Boston to New York without any dramas, which is nearly always a good thing when you’re travelling. One nice thing about taking the train (apart from missing the ten-hour airport queues and security checkpoints) is that you get to see all the gorgeous scenery along the way. Since it’s autumn in the USA right now, I got some very picturesque scenery of gorgeous brown and yellow tree leaves. I unfortunately didn’t see any autumn-like scenery in Boston, since the city’s a bit too warm for the browning leaves, so all the nice autumnness is out in the countryside. Mmm, soothing scenery good.

We unloaded at Penn(sylvania) Station in New York City on 34th Street: I was planning to catch a taxi to my hotel (on 77th and Broadway), but since Flea is a native New Yorker and knows the subway lines pretty well, navigating the subway to the hotel was simple with her help. I’m really impressed by New York’s subway system: trains tend to be very much on time, there are subway stops very frequently (at least in Manhattan), there are lots of signs posted up everywhere telling you what platform you’re on and what platforms you can transfer to, transferring is really simple, and the trains are fast. (Express trains actually run on a completely separate line rather than sharing a line with slower trains; what a concept! :-) It looks like the designers of the subway managed to make it cope with the population increase very well: in the few times that we’ve caught the subway in rush hour, the trains weren’t all that full, and trains came once every two or three minutes. If only Sydney had a subway system to match New York’s!

As for the actual conference that we’re attending here, that’s been great so far. Conrad and I gave a demo and a poster session (short paper) on Tuesday, and both of them went well: we had over a dozen people talk to us in the demo session, of which a few seemed genuinely interested in the work we’re doing, and around ten people visit us in the poster session. I also managed to finish off an initial implementation of what hand-wavingness we were discussing in our short paper about 10 minutes before the poster session started, which ruled. Flying by the seat of your pants is always fun. There were some very cool other posters and demos around, too, including a very cool one on graphing relationships between various sorts of music and musicians (which was admittedly mostly very cool because it was graphing relationships between bands I like, such as DJ Shadow and Faithless …). There was even one poster was on algorithms for maintaining consistent global state for online multiplayer games; buggered if I know what that has to do with multimedia, but it was appropriately awesome, nevertheless.

Columbia University, where the conference is being hosted, is gorgeous. I promise I’ll put some photos up in my gallery soon, but for the time being, I can try to summarise it as: renaissance-like, neo-classical, generally pearl-white coloured, peaceful, inspiring feel. Like Cambridge, MIT and Harvard, it makes me wish I was five years younger and doing an undergraduate degree again. :) (Though New York isn’t quite as much of a meat market as Boston is. Very important factor, you know.)

Anyhoo, now that all our demos and presentations for the conference are over, we can wind down a bit and relax: attend the conference (and/or satisfy my shopping fix) during the day, and head to the clubs and pubs at night. We did go out to two cool pubs on Sunday (Fez and some-other-name-I-can’t-remember) since it was K’s birthday that day, but I’m sure I’ll be dragged out to be sufficiently intoxicated later in the week too. Yay, work bit over, time to play!

Comments

Ghost in the Shell: Standalone Complex

I’ve seen Volumes 1 and 2 now, and it’s looking like it’s going to be a really good anime series. It’s rather difficult to compare it to the quintessential Cowboy Bebop series since I haven’t got to the ending yet (and Bebop went from great to awesome after seeing its memorable ending), but the episodes so far seem to set up a very, very promising storyline indeed.

Aside from that, the theme song (“Inner Universe”) by Yoko Kanno just absolutely rips. Her soundtrack for Cowboy Bebop showed that she’s a genius, and her consistent, continued awesomeness in the soundtrack for Standalone Complex shows she’s a true prodigy. Arguably one of the best musicians of this entire century, in my totally overrated opinion.

Comments

Boston, Part the Second

You’ll all be glad (I hope) to know that our presentation at the MIT Media Lab went quite well. We spoke with some of the folks there, including Ted Selker (inventor of the beloved (?) red-nosed pointing device popular on the IBM Thinkpad and Toshiba laptops), Henry Lieberman and Barry Vercoe (inventor of Csound), and gave a presentation to around 10 people which went quite smoothly. I definitely felt humbled at MIT: they have a lot of smart people there, who do a lot of rather smart things. Whether the media lab is part of the smart group, I’ll reserve judgement on that and leave that decision for the Internet rumour-mongers ;).

Since that was the major task for the week all over, I’ve have had two pretty cruisy days on Friday and Saturday: both days involved beer, learning a bit about baseball, exploring Boston, and chatting to Monty. On Friday lunch (neé breakfast), Monty took us to an awesome little Chinese restaurant named Mary’s, famous for their Dun Dun Noodles, which were apparently so beloved by the Boston community that they somewhat regularly pack them into dry ice containers for their customers to take on plane flights to other cities. (True story. No coincidence that Mary’s carries the Annals of Improbable Research magazine, I’m sure.) On the rest of Friday, Conrad and I visited the MIT Coop campus store, which, in America, is pronounced “Kupe”. As in, the things which chickens go cluck clik in. Riiight. We also visited the Harvard Coop book store (since we were too manly and/or stupid to find the actual Harvard Coop campus store), which disappointingly did not have any Luis Royo nor BattleTech books in stock. After that, we met up with Monty at home for some Tex-Mex flava dinner, where I had a Corona, a Tequila shot and another beer later on. It was all good until I was wiped out at eleven o’clock, and decided to hit the hay early. (I’m sure the Tequila had absolutely nothing to do with that, too.)

Today, Conrad went to the GNOME Summit at MIT, so I’ll let him tell you about that. I instead went to the Lord of the Rings exhibition at the Museum of Science, only to find out that the first ticket available was for 5:15pm. That turned out to be pretty good timing, since I also wanted to visit the Cambridgeside Galleria shopping mall and, err, do a bit of window shopping. Of course, window shopping turned into non-window shopping since I found a Brookstone store there, as well a Best Buy. All I can say is: I am now the owner of Ghost in the Shell: Standalone Complex, Volumes 1 and 2, special editions. Awesome.

After non-window shopping, I visited the Museum of Science again to attend the Lord of the Rings Exhibition. In a nutshell, it was fantastic. You get to see all the costumes, armour, weapons, models, and behind-the-scenes techniques behind the film, for every character from goblins to Frodo. It would be worth going to just to see the incredible amount of love and care put into the costumes: the painstaking amount of work done by Three Foot Six Studios and WETA in New Zealand really are worthy of being exhibited. (For all the guys, yes, you get to see Arwen’s gowns, and for all the girls, you can all see Galadriel’s gowns :-). Some of the armours, weapons and models take your breath away.

I think it’s a fitting end to a wonderful week in Boston: closing the week with the exhibition of the revival of a classic tale suits the city so quaintly.

Comments

Boston

Boston’s a really pretty, quaint little city: a population of 600,000, mostly to support students (including masses of computing geeks who own far too many Powerbooks and iBooks — more on that later), with gorgeous harbours and peninsulas, and awesome neo-classical architecture which permeates the heart of the city. MIT and Harvard would be absolutely fantastic places to study: like Cambridge in the UK, Boston really makes me wish I was five years younger again, staying at a college, and studying at a great university. The surroundings really are inspiring, and even though the city is a bit old and squalid in some places, the neo-classical sandstone architecture which forms downtown just gives it a really awesome classical charm. The public transport system here isn’t too bad either, despite Monty’s attempts to convince me that it’s a load of crud. The subway system seems to be quite reasonable, and one interesting design aspect of it is that there’s about a kilometre between the subway stops located downtown — meaning that a subway station is never more than about 5 minutes walk away if you’re in Boston proper. Very convenient: while that means that trains stop more often in the city, it sure beats Sydney’s 15-odd minute walk between Town Hall and Central.

So far, Conrad and I haven’t explored too much, though this is partially because Boston really isn’t all that big: the population is only around 600,000 people, after all. We’ve walked around the city quite a bit, and covered some of Cambridge and MIT (but not Harvard — yet). Since we are officially here on work business, we’ve both been good boys and done quite a reasonable amount of work during the day. Rather than hacking at Monty’s, we’ve been enjoying the facilities provided by the fine Diesel CafÈ: reasonable coffee, wireless Internet access, power points, and comfortable seats for hours of hacking. I’ve mostly been working on our (Symbian-based) mobile phone multimedia browser, since we’re demonstrating tomorrow at MIT. So, it’s been hacking during the day with beer and socialising at night. Not that we’re reinforcing the Australian stereotyping by bringing back two cases of beer back to the house every day and polishing it off. (Though I’ve been a responsible boy and have only been drinking one or two bottles per night, yes sirree.)

For now, it’ll be a bit more Symbian hacking, and then hopefully we’ll go visit Harvard tomorrow followed by a big successful demo at MIT. All good.

Comments

Toronto, Part the Second

Well, CN Tower isn’t very exciting when you don’t ride the elevator to the top. It is rather impressively tall and everything, but I didn’t feel like paying the $30 to ride up to the top with no Michelle. (Cue “awwww” sound here.) Ditto for visiting Niagara falls: I’m really quite keen to go there, but I’ll bide my time until I’m there with the Better Half. (It’ll make my experience there more rewarding: yeaaaah, that’s right!) So, instead of sightseeing, I mixed with the locals: walked around Toronto a bit more and explored the city during the day, and went to the pub and played pool with some of Dom and Zoe’s mates. (I actually lost to Dom at pool, which was apparently quite an effort — I blame the excellent beer.) Since we were all feeling a little bit knackered by the end of the night but not quite ready for sleep yet, we sat down to watch The Lion King (the movie, not the play), which was absolutely excellent. If you haven’t seen it, ‘tis highly recommended: definitely one of Disney’s finer creations.

I visited Herr Wolfgang Thaller the next day in Hamilton, Ontario, which is about an hour away from Toronto via bus. I found Hamilton to actually be a little bit more seedy than Toronto, which was odd considering that Hamilton’s population is much smaller, but it was still felt reasonably friendly and safe. After a long lunch and coffee (as in, coffee took the entire afternoon), over which much Haskell discussion took place, Wolfgang and I headed back to Toronto to grab some dinner and do some GHC hacking. More accurately, I introduced Wolfgang to Vietnamese Beef Noodle Soup (possibly one of the greatest creations known to humankind), and then encouraged him to do GHC hacking while I surfed the web and reaped the fruits of his labours. What can I say? Distributed code development is excellent when you’re a lazy sod. We ended up staying up until a respectably late hour (~2am), and the next day, did the geek thing and went gadget shopping. All I have to say about gadget shopping is: how on earth do those little dozen or so Yum Cha Asian computer sweatshops within about 10 metres of each other manage to stay in business?

And so, that was Toronto. Cheap, awesome food, got to catch up with Dom, Zoe and Wolfgang, meet some dudes who worked on Lord of the Rings (“Dudette, do you know who I am?! I worked on Lord of the Rings!” works quite well as a pick up line), explore a great city, and generally had myself a ball. Next stop: Boston!

Comments

Haskell's Performance

This thread (still currently active at the time of writing this blog entry) on the haskell-cafe mailing list is a nice example of the one big, major problem I have with Haskell: performance.

To summarise the thread, the infamous great language shootout (which is only infamous if you’re into alternative languages like Haskell, which get their asses handed to them in microbenchmarks for varying numbers of silly reasons) showed that Haskell placed last in the word count test. (Note that the benchmark results have since been updated with a new GHC-specific version of the solution, which is far uglier, but also about 60x faster than the original version.) The Ocaml guys went to town on this result, and of course claimed that Haskell was dreadfully inefficient, with a half-condescending remark at the end that “Haskell’s approach has been expensive in terms of performance”. The Haskell community ignites, and comes up with a version within a day or two that is twice as fast as GNU wc@, which is more or less on par with the Ocaml @wc version. This is good. However, two rather bad things stand out to me:

  • Malcolm Wallace’s Space leak or what? post. Sure, Haskell has a space leak here. The problem is, you don’t notice these space leaks unless you’re an expert Haskell programmer. (I certainly can’t tell that code has a space leak, and I’ve been using Haskell for quite a while now.) The bigger problem is how to fix those space leaks.
  • The final solution to the wc@ program submitted for the contest "looks like a goat":http://shootout.alioth.debian.org/lang/ghc/wc.ghc.html. Why should I have to use @unsafeRead (and thus potentially destroy any guarantees that Haskell’s awesome type system gives me) to get decent performance out of this thing, and why do I need to resort to IOUArray and lots of uses of seq? Compare the Haskell version to the O’Caml version, and draw your own conclusions about which is more declarative, high-level, and most importantly, which one doesn’t require an expert in the language to write.

The main problem I see with all this is that it’s just too hard for an average Haskell programmer to get good performance out of Haskell. As people have shown on the haskell-cafe mailing list, you certainly can get very good performance out of Haskell: in plenty of cases, surpassing an equivalent version written in C. However, you can only do that if you’re a complete Haskell guru, and even then, things start looking really ugly: you might as well just rewrite that part of the program in C and call it via the Haskell Foreign Function Interface. I think the main cause of this is that Haskell is simply too unpredictable: in most cases, it’s laziness which causes the unpredictability. Note that this is different from saying laziness leads to slower performance: this is untrue, because in many cases, laziness can improve performance. Predictability is the important factor.

For optimisation, you must know what factors are causing things to be slow, otherwise you’ll be searching in the dark for what bits to optimise. So, Haskell users will tell you to profile (which is sound advice no matter what language you’re using). That’s fine. The problem then is you have to know why something is slow, and there’s where Haskell can get complex. Is there a space leak? (Do you even know what a space leak is?) Is your array strict instead of lazy? If it’s strict, is it boxed instead of unboxed? (Do you even know what unboxing is?) Can you use unsafeRead instead of readArray? (Did you know that unsafeRead exists? I sure didn’t!)

I think if Haskell were to give the programmer slightly more control (or, in more formal terms, enable the programmer to choose from different operational semantics), Haskell optimisation could be moved from the expert’s domain to the novice’s domain. This is one area where the Clean language has innovated over Haskell: one may claim that uniqueness types and heavyweight use of strictness/unboxing annotations make Clean programs far less pretty than their Haskell version (and I agree), but if you need speed, you can get it in Clean much more easily in than Haskell. The language specification gives you more control over what’s going on; strictness annotations are one example of such a control mechanism. GHC does give the programmer access to many new operations intended for optimisation, but in a syntactically-heavy manner, which discourages you from using them. This is in contrast to Clean, where you can, for example, make an unboxed, strict array just by writing [# 1, 2, 3 !] rather than [1, 2, 3]. I don’t know how to make a strict, unboxed array in Haskell without looking up GHC’s library documentation.

It’ll be interesting to see whether the Haskell language itself evolves to plug this problem. I know I would recommend Haskell rather than O’Caml to more people if it made performance optimisation easier. Note that what I’m discussing here is convincing a Haskell compiler to give good performance, rather than blazing performance: if you absolutely require blazing performance and nothing else will do, code that small fragment in C or Assembly, and call it via the FFI. Multi-language approaches are good. However, the goal is to make it easy to optimise programs from an abysmal run time to a good run time: a run time that you wouldn’t be embarrassed about demonstrating to non-Haskell folks.

Update: This was originally written toward the end of 2004. I’m glad to say that things have changed since then: Don Stewart’s Data.ByteString library has nailed the performance gap between Haskell and C for string processing and binary I/O (even beating C occasionally, thanks to GHC’s far superior compiler optimisations vs C and gcc), which is arguably the main area where you’d run into serious performance problems easily. GHC 6.6 has also gained bang patterns and some syntactic sugar for arrays. (The latter isn’t quite as nice as Clean’s strict array syntax, but it’s a huge improvement.) Both these features greatly lower the barrier to entry if you’re trying to coax blazing performance out of Haskell.

Comments