DevTools/Performance/JIT

From MozillaWiki
Jump to: navigation, search


Overview

When approaching the upper bounds of squeezing out performance, the more relevant the platform details become. We want to expose engine-level information on how JavaScript gets executed in Firefox in order to highlight areas of code that can be better optimized. As Spider Monkey's optimization tiers are wrapped in arcane magic and mystery, we also need a way to translate this engine data to actionable directives, able to be interpreted by performance-seeking engineers without needing to be JIT hackers.

Using this translated JIT data, we can then reference the profiler's samples to guide a user to focus on optimization for especially hot areas of code, also leveraging any "badness" weight to levels of optimizations. If we are successful in translating JIT data to actionable instructions for the advanced performance engineers, then the next step is to distill this information to be even more accessible to the average web developer, hiding most of the JIT-jargon.

There will be at least this "advanced view", behind a pref, as a subview in the Performance tool's Call Tree (or maybe its own detailed view?), and if we make actionable information accessible enough, subtle guides for all users in the profiler.

Currently, in Fx40, the JIT Optimizations view is available in the performance tool behind `devtools.performance.ui.show-jit-optimizations` for displaying the JIT optimization attempts per site as an initial prototype.

Users/Use Cases

  • Help in debugging the JIT itself for Ion Monkey engineers
  • Optimizing new ES.* features in Spider Monkey
  • Finding how to optimize hot areas of code (advanced usage)
    Frameworks (React, Ember, PlayCanvas, jQuery, Three.js)
    Environments (Shumway, J2ME.js)
    SIMD?
  • Ensuring functions stay at the highest level of optimization (more important than using better optimization strategies per optimization site)
  • Guide web developers to optimize their web app with low-hanging-fruit, without needing engine knowledge

Requirements/Steps

Meta bug

Gather Information

gather common deoptimization patterns, see if there are any possible (djvj, shu)

Expose Documentation

docs With the raw JIT opt data view in Fx40, translate the optimization attempts, outcomes, Ion types, with better descriptions. Not necessarily actionable, but some insight.

Expose Advanced Information

JIT Coach

  • Actionable suggestions for the average web developer with no JIT knowledge

UI/UX

Timeline/Milestones

  • Requirements: Mid Q2
  • Ship: Mid Q3

Evaluation Metrics

Prior Art

No documentation regarding the deopt icons, and the tooltips they use are still pretty cryptic; some deopts I've seen:

 Reference to a variable that requires dynamic lookup
 ForInStatement is not fast case
 Context-allocated arguments
 TryCatchStatement
 Optimized too many times
 Assignment to parameter in arguments object
 Bad value context for arguments value