Hunting Down Mythical “Slowness”
I recently met a developer who used Chromium instead of Firefox. Chromium’s superior startup speed was his reason for using it.This got me excited because said developer was running Linux, so it was relatively easy to measure cold startup and get a complete IO breakdown.
Turned out Firefox took roughly 23 seconds to start. After much cursing about how I’ve never seen Firefox startup this slow, I eventually gave up on figuring out what’s slowing his startup and instead we measured Chromium startup. It also turned out to also be roughly 23 seconds. The super-slow hard drive made everything slow. Turned out Chromium’s superior startup was a myth in this case.
Measuring Startup
As a result of investigating the startup myth above, my kiwi coworkers encouraged me to post a comparison of Chrome/Firefox startup. I am at linuxconf at the moment so I did the comparison on my laptop.
Laptop configuration:
- Intel(R) Core(TM)2 Duo CPU L9400 running at 800Mhz to amplify any performance differences.
- HITACHI HTS722020K9SA00 harddrive for the user profile and browser binaries
- OCZ Vertex 30GB SSD for system libraries/configuration.
- Fedora 12, Minefield 20100119 tarball, chromium-4.0.285.0-0.1.20091230svn35370.fc12.i686
- sudo sync && sudo sysctl -w vm.drop_caches=3 && sudo sysctl -w vm.drop_caches=0 to clear the disk cache inbetween runs What am I testing? I am measuring the time between invoking the browser until a JavaScript snippet embedded within a basic webpage is executed (ie Vlad’s approach, with a slightly modified startup.html). The above sysctl command clears disk caches, this creates a similar situation to when one turns on the computer and it hasn’t yet loaded all of the browser libraries from disk into memory. This is a blackbox approach to measuring how long it takes from clicking on the browser icon to get an interactive browser.
Firefox commandline: firefox -profile /mnt/startup/profile/firefox -no-remote file://pwd/startup.html#python -c 'import time; print int(time.time() * 1000);'
Chromium commandline: chromium-browser –user-data-dir=/mnt/startup/profile/chrome file://pwd/startup.html#python -c 'import time; print int(time.time() * 1000);'
Both of these tests are done with an empty profile that was populated and has settled after running the browser a few times.
Results
The following numbers are milliseconds reported by the startup.html above.
Running Chromium five times: 4685, 4168, 4222, 4197, 4232
Running Minefield five times: 3155, 3273, 3352, 3311, 3322
I picked Minefield because that’s the browser that I run and the codebase that I focus on. The linux Chromium channel seems to be the closest parallel to Minefield. I did not test on Windows because it is a bit of a nightmare to measure cold startup there.
Conclusion
On my system Minefield is around 30% faster at starting up with an empty profile than Chromium (the difference is amplified by running the CPU at 800Mhz). For comparison of Minefield against older Firefox versions, see Dietrich’s post.
I suspect that there is a relatively small difference between the two browsers because we are running into the fundamental limitations of loading large applications into memory (my rant).