standards-positions
standards-positions copied to clipboard
Explicit compile hints
WebKittens
No response
Title of the spec
Explicit compile hints
URL to the spec
https://explainers-by-googlers.github.io/explicit-javascript-compile-hints-file-based/
URL to the spec's repository
No response
Issue Tracker URL
No response
Explainer URL
https://docs.google.com/document/d/19xTAM4A75tz0xUq_velMzGA4JHEgXpyflUxXTcuNiyE
TAG Design Review URL
No response
Mozilla standards-positions issue URL
https://github.com/mozilla/standards-positions/issues/780
WebKit Bugzilla URL
No response
Radar URL
No response
Description
Knowing which JavaScript functions to parse & compile upfront can speed up web page loading.
Some example numbers from our experiments:
- Data set of 4 big web pages, local cold runs: Parse + compile time decreases 4 - 13 %, foreground parse + compile time decreases 59 - 86%.
- Internal web devs report 5% improvement in their page load time metrics w/ PIFEing all functions in core file.
Currently, V8 uses the PIFE heuristic to direct which functions to compile. This heuristic has existed for a long time and is well known to web developers. V8 and SpiderMonkey follow the PIFE heuristic, but JavaScriptCore doesn't.
Using PIFEs for transmitting information about which functions should be eager-compiled has downsides, though. Especially:
- using it forces using function expressions instead of function declarations; this might regress in all browsers, and for browsers which don't follow the PIFE hint there's no upside
- it cannot be applied to ES6 class methods
Thus, we want to experiment with other ways to transmit compile hints.
We don't want to cause extra work for browsers who don't want to support compile hints; we'll only explore options where ignoring the hints happens naturally.
We're currently starting early experiments with potential users, and will create the actual spec based on feedback.