All About Performance

and other stuff by Taras Glek

Firefox 7: Cheating the Operating System to Start Faster

****Firefox 7 features improved startup speed. Our research has shown that most OSes are not capable of starting large programs efficiently (see my older blog entries). As a result, Firefox 7 will explicitly tell the OS to aggressively preload our xul.dll/libxul.so/XUL library before passing it on to the runtime linker. This marks the productization of the approach explored in “20-line patch that doubles Firefox startup” that got people so excited. See bug 552864 and dependent bugs for exciting technical details.

Do Not Try this at Home: Ugly Windows

Note: Windows Prefetch does everything possible to thwart exciting startup optimizations. Above optimization only works when prefetch is disabled/broken (ie Firefox should be faster with Windows Prefetch off). See this comment on disabling prefetch for Firefox. Alternatively one may get Windows Prefetch to not slow down Firefox startup by the following magic incantation:

  1. Install Firefox (or delete the windows prefetch entry for existing Firefox 7)
  2. Reboot (Do not start Firefox after installation!)
  3. Start Firefox. Above helps populate the Windows Prefetch in a less counter-productive way. Explanation: on warm startup Windows Prefetch records irrelevant IO operations and blocks Firefox startup to preload files that Firefox accesses after startup.

Note: the heuristic that we use to detect Windows Prefetch will also prevent this optimization from kicking in on some exceptionally slow hard drives when prefetch is off. This is unfortunate as this optimization is most dramatic on exceptionally slow machines.

According to our preliminary telemetry data, less than 25% of our Windows users have Windows Prefetch off and can benefit from vastly improved startup. We expect to improve this in future Firefox releases by scheduling a prefetch cleanup operation similar to the script in above bugzilla comment.

Operating systems without counter-productive startup heuristics (ie Mac/Linux) will simply allow Firefox 7 to start faster.

Comments