Performance

The articles linked to from here will help you improve performance, whether you're developing core Mozilla code or an add-on.

Documentation

Reporting a Performance Problem
A user friendly guide to reporting a performance problem. A development environment is not required.
Benchmarking
Tips on generating valid performance metrics.
Performance best practices in extensions
A performance "best practices" guide for extension developers.
Measuring Add-on Startup Performance
A guide for add-on developers on how to set up a performance testing environment.
XUL School: Add-on Performance
Tips for add-on developers to help them avoid impairing application performance.
GPU performance
Tips for profiling and improving performance when using a GPU.
Scroll-Linked Effects
Information on scroll-linked effects, their effect on performance, related tools, and possible mitigation techniques.
Automated Performance Testing and Sheriffing
Information on automated performance testing and sheriffing at Mozilla.
Best practices for Front-end Engineers
Tips for reducing impacts on browser performance in front-end code.

Memory profiling and leak detection tools

The Developer Tools "Memory" panel
The memory panel in the devtools 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
DMD is a tool that identifies shortcomings in about:memory's measurements, and can also do multiple kinds of general heap profiling.
Are We Slim Yet
areweslimyet.com (a.k.a. AWSY) is a memory usage and regression tracker.
BloatView
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
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
GC and CC logs can be generated and analyzed to in various ways. In particular, they can help you understand why a particular object is being kept alive.
Valgrind
Valgrind is a tool that detects various memory-related problems at runtime, including leaks. Valgrind is used as part of Mozilla's continuous integration testing, though the coverage is limited because Valgrind is slow.
LeakSanitizer
LeakSanitizer (a.k.a. LSAN) is similar to Valgrind, but it runs faster because it uses static source code instrumentation. LSAN is part of Mozilla's continuous integration testing, with most tests running through it as part of the AddressSanitizer (a.k.a. ASAN) test jobs.
Apple tools
Apple provides some tools for Mac OS X that report similar problems to those reported by LSAN and Valgrind. The "leaks" tool is not recommended for use with SpiderMonkey or Firefox, because it gets confused by tagged pointers and thinks objects have leaked when they have not (see bug 390944).
Leak Gauge
Leak Gauge is a tool that can be used to detect certain kinds of leaks in Gecko, including those involving documents, window objects, and docshells.
LogAlloc
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.
Memory Profiler
The memory profiler samples allocation events and provides different views to analyze the allocation characteristic.

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

Profiling and performance tools

Profiling with the Developer Tools Profiler
The profiler built into the developer tools has a high-level waterfall, detailed call tree, allocations and GC profiling, and flame graphs. It is available on all platforms and release channels, and also supports remote profiling b2g and Fennec.
Profiling with the Firefox Profiler
The Firefox Profiler is a good tool to start with, particularly for understanding where time is spent within C++ code in Firefox.
Profiling with Instruments
How to use Apple's Instruments tool to profile Mozilla code.
Profiling with Xperf
How to use Microsoft's Xperf tool to profile Mozilla code.
Profiling with Concurrency Visualizer
How to use Visual Studio's Concurrency Visualizer tool to profile Mozilla code.
Profiling with Zoom
Zoom is a profiler for Linux done by the people who made Shark
Measuring performance using the PerfMeasurement.jsm code module
Using PerfMeasurement.jsm to measure performance data in your JavaScript code.
Adding a new Telemetry probe
Information on how to add a new measurement to the Telemetry performance-reporting system
Profiling JavaScript with Shark (obsolete - replaced by Instruments)
How to use the Mac OS X Shark profiler to profile JavaScript code in Firefox 3.5 or later.
Profiling with Shark (obsolete - replaced by Instruments)
How to use Apple's Shark tool to profile Mozilla code.
Investigating CSS Performance
How to figure out why restyle is taking so long

Power profiling

Power profiling overview
This page provides an overview of relevant information, including details about hardware, what can be measured, and recommended approaches. It should be the starting point for anybody new to power profiling.
tools/power/rapl (Mac, Linux)
tools/power/rapl is a command-line utility in the Mozilla codebase that uses the Intel RAPL interface to gather direct power estimates for the package, cores, GPU and memory.
powermetrics (Mac-only)
powermetrics is a command-line utility that gathers and displays a wide range of global and per-process measurements, including CPU usage, GPU usage, and various wakeups frequencies.
TimerFirings logging (All platforms)
TimerFirings logging is a built-in logging mechanism that prints data on every time fired.
Activity Monitor, Battery Status Menu and top (Mac-only)
The battery status menu, Activity Monitor and top are three related Mac tools that have major flaws but often consulted by users, and so are worth understanding.
Intel Power Gadget (Windows, Mac, Linux)
Intel Power Gadget provides real-time graphs for package and processor RAPL estimates. It also provides an API through which those estimates can be obtained.
perf (Linux-only)
perf is a powerful command-line utility that can measure many different things, including energy estimates and high-context measurements of things such as wakeups.
turbostat (Linux-only)
turbostat is a command-line utility that gathers and displays various power-related measurements, with a focus on per-CPU measurements such as frequencies and C-states.
powertop (Linux-only)
powertop is an interactive command-line utility that gathers and displays various power-related measurements.
JavaScript, XPCOM, Developing Mozilla, Extensions, Addons