In praise of open source
When it comes to the merits of many open source software systems I’m not the most generous guy (in terms of compliments), but in general open is always better then closed!
I had to release a new version of rTunes this weekend because of a wincom id change with iTunes 7.4.2.4. There was this nagging issue with rTunes and really slow web serving when I was using a remote computer, this was really irking me and since I was updating the source I thought I’d track this down. So off I went and started dropping in some profiling code, after the first test I had a pretty good idea of what was going on (and also why no one had complained about this issue yet.) Python’s BaseHTTPServer generates a log entry when you send a response, the problem as it turns out, the log entry wants to print the host name which means it does a DNS “fully qualified name lookup” and there’s the rub; I’m running DNS at home (and yes it’s not properly setup where Windows is concerned but it works for my purposes) but these name lookups were taking 4 secs on my network which is ridiculous performance, so it was simple to override the address_string to simply return the IP. If you’ve ever setup Apache you know they strongly recommend turning off name lookups, no kidding, so why this library has this as a default is kind of weird and a little bit dumb. After changing this behaviour performance improved by two orders of magnitude, woohoo.
The whole point of this story is that given the documentation of the BaseHTTPServer library and most other libraries of all sorts (free and commercial), without the source I would have spent significantly more time tracking down this issue with a closed source opaque library.
Vive la open source!