Performance:Startup

From MozillaWiki
Jump to: navigation, search
Do not edit this page THIS PAGE IS PROPOSED FOR DELETION 10/17/2023
This information is very outdated, please see https://firefox-source-docs.mozilla.org/performance/index.html for more current information about performance tools in Mozilla.

Goal

Here are the goals of that these brownbags are trying to achieve in order of priority.

  1. Reduce footprint of embeddable engine and netscape browser
  2. Reduce pageload time
  3. Reduce new window open time
  4. Reduce startup time

What do engineers want from these brownbags ?

  1. Measurement Tools and Techniques
  2. Analysis Tools and Techniques
  3. Patterns to fixing the areas found

This is corresponds closely to the performance/footprint improvement loop : measure -> analyze -> fix -> measure

Target Audience

Brownbag should be targeted at the average engineer. Little assumptions should be made about the knowledge of facilities such as c++, strings, xpcom etc. We should cover facilities and provide patterns that people can use as much as possible even if it is trivial.

Measurement

(start with a New Created Profile)

Analysis Tools

Remember the simple things : printfs, #if 0 code and putting timers can go a long way.

  1. MOZ_TIMELINE http://www.mozilla.org/performance/measureStartup.html
  2. Quantify [windows] http://www.mozilla.org/performance/profiling-juju.html
    • Use optimized / MOZ_PROFILE build
    • Increase swap to atleast 500MB
    • Use Function level profiling
    • Command line arguments: -P 'Default User' file:///c|/tmp/quit.html
    • Focus subtree on main1
  3. jprof [linux] http://www.mozilla.org/performance/jprof.html
  4. Simon Fraser is working on a graphical analysis tool for mac
  5. printfs
  6. #if 0 : a very useful method in easily finding out the cost associated with a #particular piece of code or feature
  7. mallocsites: Number of allocations http://www.mozilla.org/performance/mallocsites20011031.html
  8. BloatView - Number of objects created http://lxr.mozilla.org/mozilla/source/xpcom/doc/MemoryTools.html
    set XPCOM_MEM_BLOAT_LOG=1
  9. strace [linux] - view all system calls made by application

Current Performance Project Plan

http://mozilla.org/performance/Performance_Project.html

Performance Theory

There are two approaches to fixing performance.

  • Eliminate the cost - most desirable
  • Reduce the cost - better algorithms, data structures, code

Evaluate if eliminating the cost, even conditionally, is possible before rushing to reduce the cost. E.g

E.g. International code was loading charset.properties file on startup. This file contained a mapping of charsets to internal normalized form. It so happens that only a few charsets are encountered by a large % (like 90%) of our users. The fix that Frang Tang and Juraj Betak came with was to make an internal table of those frequently used 5 charsets and load the file only if a charset outside of this list if encountered. Thus the entire cost of loading charset.properties was eliminated rather than thinking about making the file format different so lesser bytes are read in.

Checklist

  1. Number of files loaded - strace and MOZ_TIMELINE (for files from jar)
  2. Any Directory enumeration : strace
  3. Any stat() happening : strace
  4. Dlls loaded : strace
  5. Are we eagarly building up any other resources: menus, hashtables
  6. Number of memory allocations : mallocsites
  7. datastructure or architectural improvements
  8. Number of objects created - BloatView

Stats

Here are some interesting stats on our startup:

  • Malloc: 22% (122,563 calls)
  • new: 15% (102,535 calls)
  • free: 3% (82,332 calls)
  • delete: 2.3% (70,722 calls)

Tinderbox

Main tinderbox: http://tinderbox.mozilla.org/showbuilds.cgi?tree=SeaMonkey Testerbox: http://tinderbox.mozilla.org/showbuilds.cgi?tree=SeaMonkey-Testerbox

QA measuring startup and page-load

Daily results get posted to netscape.public.mozilla.performance newsgroup