mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 01:48:05 +00:00
e8306f0cbe
Initial documentation for new users. Differential Revision: https://phabricator.services.mozilla.com/D157854
5.9 KiB
5.9 KiB
Performance
This page explains how to optimize the performance of 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
- Tips on generating valid performance metrics by benchmarking
- GPU Performance Tips for reducing impacts on browser performance in front-end code.
- Automated Performance testing and Sheriffing Information on automated performance testing and sheriffing at Mozilla.
- Performance best practices for Firefox front-end engineers Tips for reducing impacts on browser performance in front-end code.
- Reporting a performance problem A user friendly guide to reporting a performance problem. A development environment is not required.
- Scroll Linked Effects Information on scroll-linked effects, their effect on performance, related tools, and possible mitigation techniques.
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.
Profiling and performance tools
- JIT Profiling with perf Using perf to collect JIT profiles.
- 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.
- Adding a new telemetry probe Information on how to add a new measurement to the Telemetry performance-reporting system
Power Profiling
- An overview of power profiling. It includes details about hardware, what can be measured, and recommended approaches. It should be the starting point for anybody new to power profiling.
- (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.
- (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.
- (All-platforms) TimerFirings logging is a built-in logging mechanism that prints data on every time fired.
- (Mac-only) Activity Monitor and top 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.
- (Windows, Mac and Linux) Intel Power Gadget 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.
- (Linux only) perf 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.
- (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.
- (Linux-only) powertop is an interactive command-line utility that gathers and displays various power-related measurements.
Performance Metrics
- PerfStats - A framework for low-overhead collection of internal performance metrics.