Performance

This page explains how optimize the performance the Firefox code base

The test documentation explains how to test for performance in Firefox. The profiler documentation explains how to use the Gecko profiler.

General Performance references

Memory profiling and leak detection tools

  • The Developer Tools Memory panel supports taking heap snapshots, diffing them, computing dominator trees to surface “heavy retainers”, and recording allocation stacks.

  • About:memory about:memory is the easiest-to-use tool for measuring memory usage in Mozilla code, and is the best place to start. It also lets you do other memory-related operations like trigger GC and CC, dump GC & CC logs, and dump DMD reports. about:memory is built on top of Firefox’s memory reporting infrastructure.

  • DMD is a tool that identifies shortcomings in about:memory’s measurements, and can also do multiple kinds of general heap profiling.

  • AWSY (are we slim yet?) is a memory usage and regression tracker.

  • Bloatview prints per-class statistics on allocations and refcounts, and provides gross numbers on the amount of memory being leaked broken down by class. It is used as part of Mozilla’s continuous integration testing.

  • Refcount Tracing and Balancing are ways to track down leaks caused by incorrect uses of reference counting. They are slow and not particular easy to use, and thus most suitable for use by expert developers.

  • GC and CC Logs

  • Leak Gauge can be generated and analyzed to in various ways. In particular, they can help you understand why a particular object is being kept alive.

  • LogAlloc is a tool that dumps a log of memory allocations in Gecko. That log can then be replayed against Firefox’s default memory allocator independently or through another replace-malloc library, allowing the testing of other allocators under the exact same workload.

  • See also the documentation on Leak-hunting strategies and tips.