Optimization Tip 1: Make sure you’re measuring what you think you are

February 5th, 2006

Optimization is a subject fraught with witchcraft, voodoo, and superstition. Far too often it is done badly and pseudoscientifically. The first rule of optimization is that you can’t do it without measuring . Almost any guess you make about performance is at best irrelevant and often actively harmful. A common technique is to write a benchmark that runs the piece of code you’re trying to optimize several thousand times, and prints out the time it takes to run. Then tune until the time comes down.

They’re at least ten reasons why this technique fails more often than it succeeds (forgetting to account for HotSpot initialization, optimizing a piece of code in which the program spends a trivial amount of time, etc.) but recently I encountered an 11th: the benchmark may not be exercising the code you think it is. This turns out to be surprisingly common, and the more complex the code is, the more likely this is to occur.
Read the rest of this entry »

Undocumented Changes in Java 6 Mustang: IOError

February 2nd, 2006

At some point, a new java.io.IOError class was added to Java 6. This is “Thrown when a serious I/O error has occurred.” No further explanation is offered.

This is not listed as a change in the JDK 6 documentation; and I haven’t noticed this addition in any JSRs, though I could easily have missed one. Can anyone explain where this new class has come from and what is likely to cause it be thrown?
Read the rest of this entry »

Garmin Mapsource: When You Just Don’t Care If the Software Works

January 31st, 2006

Friday I installed one of my Christmas presents, a complete set of 1:100000 scale topo maps of the U.S. for my Garmin eTrex Vista GPS receiver. I’d rather use the more detailed 1:25000 maps I bought from James Associates; and I’d rather use my Mac to load them onto the GPS unit; but Garmin won’t document the protocol for uploading maps; and that protocol doesn’t seem to have been effectively reverse engineered yet; so I had to boot Windows and load them from the PC using Garmin’s own MapSource.
Read the rest of this entry »

iPhoto Tip 1: Batch Change

January 30th, 2006

Have you ever taken 173 pictures of your dog and wanted to quickly set the title of each one to “Spot playing”? That is, have you ever wanted to add the same title to several pictures at once in iPhoto? You can shift-click and command-click to select multiple pictures but as soon as you do that the Title field disappears so you can’t change any titles. 🙁

It is possible to do this though. However the option is a little hidden. Read the rest of this entry »

Intel Macs as Servers

January 27th, 2006

I’ve been thinking about getting an Intel Mac to replace the old Linux box that serves this site. However, a lot of software hasn’t been ported yet, and Rosetta emulation is slow. How much server relevant software is yet native?

Read the rest of this entry »