Search code examples
javascriptfirefoxfirefox-developer-tools

Profiler shows high cpu load in graphics, shows multiple sites?


Why does the Firefox Profiler show javascript from every tab?

When profiling my own setup I saw a log of mostly graphics (green), mostly highlighted when I select a script from plus.google.com, and talkgadget.google.com, translate.google.com. I also saw stackoverflow on the profile, so apparently it's profiling all tabs?

Why does Firefox use almost an entire cpu on graphics this way?


Solution

  • Currently, Firefox is a single process, and the profiler detects all the JS everywhere -- other tabs, Firefox itself (many components of the browser are written in JS). With multiprocess Firefox[0] coming really soon (and has been available in Nightly for almost a year now), this reduces the amount of non-content code showing up in the profiler (although there is still browser code running in that process, and this is hidden by default unless you opt to show "gecko platform data").

    The reason why these aren't hidden is because they still affect performance, so it would be inaccurate to not display Gecko and other tabs data. A while (1){} loop in one tab would lock up another, for example.

    With multiprocess Firefox coming soon, a complete redesign of the profiler/performance tools coming in the next few weeks, and some solutions on obfuscating (but not removing, as again, that'd be inaccurate) JS from other tabs[1], this should be improving, again, very soon :)

    [0] https://developer.mozilla.org/en-US/Firefox/Multiprocess_Firefox

    [1] https://bugzilla.mozilla.org/show_bug.cgi?id=1152400