Firefox/Projects/Startup Time Improvements

From MozillaWiki
Jump to navigation Jump to search

Overview

Project lead: Dietrich Ayala
Project members: Ryan Flint, Drew Willcoxon, David Dahl, Vlad Vukićević, Taras Glek, Joel Reymont, Ben Hsieh

Description: Investigate areas for improving startup time of the Mozilla platform, find & fix issues that help Fennec and WinCE.

Bugs:

  • Open (identified by "[ts]" in the whiteboard field)
  • Fixed

Results

See results in the Performance Snapshot.

Projects

Areas of Work:

Measurement & Testing

  • cold startup testing
  • dirty profile testing
  • micro-benchmarking
  • built-in startup measurement (bug 522375)
    • user-runnable Ts script, paste into js console
    • restarts browser, passing last known time
    • loads data URI that reads startup time and prints it out
    • record startup timestamp as a pref?
  • timeline of the startup path (David, Vlad)

Docs:

  • write best practices recommendation

Inactive Projects

  • Mine the Ts DTrace viz/logs (Drew)
    • Status: complete, moved on to filesystem operations below
    • Results
      • cold startup is heavily I/O-bound. 90% of cold startup time is spent in page faults and other I/O syscalls, especially read, getattrlist, and stat.
      • majority of time spent after Firefox actually gets up and running is in XBL and CSS.
  • Log and mine filesystem operations during startup (Ryan, Drew)
  • Find dead code with JSHydra (David Dahl)
    • Status: incomplete, needs tuning and file bugs on dead code found
    • bug 506128 - run jshydra to find js functions that have no callers
  • JSHydra continuous testing
    • possible test scenarios
      • ending semicolon bug (XXX)
      • dead code finder

Status Updates

References

Meta bugs

Tips, Tools

  • comparing dynamic linking time between firefox and safari on mac
    • DYLD_PRINT_STATISTICS=YES /Applications/Firefox.app/Contents/MacOS/firefox-bin
    • DYLD_PRINT_STATISTICS=YES open -a Safari

Fastload

Measuring Ts

We've been using a method Vlad blogged about here. The steps are below.

  1. save this html file somewhere locally
  2. create a new profile, run Firefox with it at least once, so all files are created, etc
  3. execute this command, with your profile name substituted, and invoking firefox in a way appropriate for your platform:

./firefox -P YourProfileName -no-remote file:///..../startup.html#`python -c 'import time; print int(time.time() * 1000);'`

The following is specific to Mac OSX and is required to evict Firefox code pages from memory and clear the Unified Buffer Cache (UBC). purge does NOT do this.

#!/bin/sh

FF=/tmp/firefox

mkdir $FF > /dev/null 2>&1
umount $FF > /dev/null 2>&1
mount_hfs /dev/disk1s2 $FF

$FF/Minefield$*.app/Contents/MacOS/firefox-bin -no-remote -foreground file://$FF/startup.html#`python -c 'import time; print int(time.time() * 1000);'`

This assumes that your removable media is at /dev/disk1s2.

First, mount you external USB HD normally and use df to see what device is being used. Then eject the drive using diskutil umount /Volumes/YourDrive and you are set.

Do not eject the device using the Finder as that will not make it available at /dev/disk1s2 or wherever it was.

Test Coverage

This is an index of Firefox startup scenarios which need automated test coverage.

TODO:

  • groups: chrome, content, extensions, labs, other?
  • mark which need no-chrome testing
test warm start cold start notes
empty profile yes yes
everything dirty bug 515540
min places yes yes informed by places-stats, bug 515540
med places yes yes ditto
max places yes yes ditto
med session informed by test pilot data
max session ditto
downloads
url-classifier data data is fully downloaded, should test page-load for a match and no match
form history
passwords
plugins
content preferences
extensions top 5?
extension update
application update
persona applied
weave
jetpack
ubiquity
page links are visited
page has microformats
page is ssl
page has plugin