no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / docs / performance / Benchmarking.md
blob3b429463f73701e624c1cd0256594854fb6df517
1 # Benchmarking
3 ## Debug Builds
5 Debug builds (\--enable-debug) and non-optimized builds
6 (\--disable-optimize) are *much* slower. Any performance metrics
7 gathered by such builds are largely unrelated to what would be found in
8 a release browser.
10 ## Rust optimization level
12 Local optimized builds are [compiled with rust optimization level 1 by
13 default](https://groups.google.com/forum/#!topic/mozilla.dev.platform/pN9O5EB_1q4),
14 unlike Nightly builds, which use rust optimization level 2. This setting
15 reduces build times significantly but comes with a serious hit to
16 runtime performance for any rust code ([for example stylo and
17 webrender](https://groups.google.com/d/msg/mozilla.dev.platform/pN9O5EB_1q4/ooXNuqMECAAJ)).
18 Add the following to your [mozconfig] in order to build with level 2:
20 ```
21 ac_add_options RUSTC_OPT_LEVEL=2
22 ```
24 ## Profile Guided Optimization (PGO)
25 [Profile Guided
26 Optimization](/build/buildsystem/pgo.rst#profile-guided-optimization) is
27 disabled by default and may improve runtime by up to 20%. However, it takes a
28 long time to build. To enable, add the following to your [mozconfig]:
29 ```
30 ac_add_options MOZ_PGO=1
31 ```
33 ## GC Poisoning
35 Many Firefox builds have a diagnostic tool that causes crashes to happen
36 sooner and produce much more actionable information, but also slow down
37 regular usage substantially. In particular, \"GC poisoning\" is used in
38 all debug builds, and in optimized Nightly builds (but not opt Developer
39 Edition or Beta builds). The poisoning can be disabled by setting the
40 environment variable
42 ```
43     JSGC_DISABLE_POISONING=1
44 ```
46 before starting the browser.
48 ## Async Stacks
50 Async stacks no longer impact performance since **Firefox 78**, as
51 {{bug(1601179)}} limits async stack capturing to when DevTools is
52 opened.
54 Another option that is on by default in non-release builds is the
55 preference javascript.options.asyncstack, which provides better
56 debugging information to developers. Set it to false to match a release
57 build. (This may be disabled for many situations in the future. See
58 {{bug(1280819)}}.
60 ## Accelerated Graphics
62 Especially on Linux, accelerated graphics can sometimes lead to severe
63 performance problems even if things look ok visually. Normally you would
64 want to leave acceleration enabled while profiling, but on Linux you may
65 wish to disable accelerated graphics (Preferences -\> Advanced -\>
66 General -\> Use hardware acceleration when available).
68 ## Flash Plugin
70 If you are profiling real websites, you should disable the Adobe Flash
71 plugin so you are testing Firefox code and not Flash jank problems. In
72 about:addons \> Plugins, set Shockwave Flash to \"Never Activate\".
74 ## Timer Precision
76 Firefox reduces the precision of the Performance APIs and other clock
77 and timer APIs accessible to Web Content. They are currently reduce to a
78 multiple of 2ms; which is controlled by the privacy.reduceTimerPrecision
79 about:config flag.
81 The exact value of the precision is controlled by the
82 privacy.resistFingerprinting.reduceTimerPrecision.microseconds
83 about:config flag.
85 ## Profiling tools
87 Currently the Gecko Profiler has limitations in the UI for inverted call
88 stack top function analysis which is very useful for finding heavy
89 functions that call into a whole bunch of code. Currently such functions
90 may be easy to miss looking at a profile, so feel free to *also* use
91 your favorite native profiler. It also lacks features such as
92 instruction level profiling which can be helpful in low level profiling,
93 or finding the hot loop inside a large function, etc. Some example tools
94 include Instruments on OSX (part of XCode), [RotateRight
95 Zoom](http://www.rotateright.com/) on Linux (uses perf underneath), and
96 Intel VTune on Windows or Linux.
98 [mozconfig]: /setup/configuring_build_options.rst#using-a-mozconfig-configuration-file