I had a few questions on how I’m measuring startup, so here’s how. This is similar to what our tinderboxes do, and it’s easy to run locally.
First, grab startup.html and save it somewhere. This html file expects the start time in milliseconds to come after a # mark, so to invoke it, you’d want to do something like (assuming a profile called “ts”, that optionally has browser.dom.window.dump set to true):
./firefox -P ts -no-remote file:///..../startup.html#1248839367203
Unfortunately the standard ‘date’ tool doesn’t help with generating the millisecond timestamp, nor does it exist on Windows. But, this python one-liner works:
python -c 'import time; print int(time.time() * 1000);'
So, combine the two together:
./firefox -P ts -no-remote file:///..../startup.html#`python -c 'import time; print int(time.time() * 1000);'`
And you’re done. You’ll see a number like “ELAPSED 800″ show up in the window and in the console. You might notice that this script also dumps “KILL” to the console as well… this isn’t me working out some aggression, instead it’s a hack that I made locally to dom/base/nsGlobalWindow.cpp’s nsGlobalWindow::Dump — if it sees “KILL” as the start of a dump line, it’ll immediately call abort(). Handy when profiling startup. Originally this was “KILL THEM“, but that seemed just a little too aggro for this blog post.
Also, the python overhead is negligible (1-2ms and constant), but if that’s too much for you, it’s not too hard to write a command line program to call gettimeofday() and print the msec time.