A few months ago I added parser telemetry for some of SpiderMonkey's JS
language extensions like legacy generators and E4X for-each. I only
measured web content and excluded chrome and add-on JS. All telemetry
reports are available at [1].
For reference, the language extensions I measured and their JS language
versions:
* for-each is available in JS >= 1.6
* destructuring for-in is available only in JS == 1.7
* legacy generators are available in JS >= 1.7
* expression closures are available in all JS versions (?)
JS_MINOR_VERSION:
I originally added the "JS_MINOR_VERSION" telemetry probe (bug 988386)
to count <script> tags with nonstandard language versions like <script
type="application/javascript;version=1.8">. To use SpiderMonkey's
language extensions, web content must opt-in with a language version.
Chrome and add-on JS default to JS 1.8. :(
The aggregate results of Firefox 32+33 riding all the release channels
and estimating total page loads with HTTP_PAGELOAD_IS_SSL:
* JS 1.6 = 9,919 <script> loads = 0.00003% of total page loads
* JS 1.7 = 1,784,130 <script> loads = 0.005% of total page loads
* JS 1.8 = 3,235,380 <script> loads = 0.008% of total page loads
JS_DEPRECATED_LANGUAGE_EXTENSIONS_IN_CONTENT:
Unfortunately, those number don't tell us if that versioned JS actually
used the language extensions, so I added parser telemetry for the actual
usage in bug 1054630.
The aggregate results for Nightly 35 + Aurora 34. Note that the numbers
below measured different versions and channels than the numbers above,
so the results are not directly comparable!
* for-each = 164 uses
* destructuring for-in = 2,796 uses
* legacy generators = 4,044 uses
* expression closures = 858,100 uses
NEXT STEPS?
I don't know who is using SpiderMonkey language extensions for real
world web content. Perhaps these are enterprise intranet web apps
written specifically for Firefox? I have a spreadsheet [2] that breaks
down the JS versions and language extensions by channel and the numbers
vary wildly.
Firefox 38 will be the next Firefox ESR and SpiderMonkey standalone
release. Before ESR 38 ships, we could add console warnings [3] (for web
content only?) that point to MDN examples porting to 1JS. In 39, we
could hide for-each [4], destructuring for-in, and legacy generators
from web content. Unfortunately, these extensions are still popular in
chrome and add-on JS, so we would have to get our own house in order
after breaking the web. :)
NEXT NEXT STEPS?
Add warnings for extension usage in chrome JS, the Add-on SDK, and
add-ons. Remove extension usage from chrome JS and the Add-on SDK.
Search AMO MXR and/or add telemetry for extension usage in add-ons. To
avoid major add-on breakage, reach out to AMO's most popular add-ons
that haven't heeded our console warnings and help them fix their code.
Then remove these language extensions from SpiderMonkey... forever! :)
chris
[1] https://telemetry.mozilla.org
[2] http://is.gd/wlP1Qj
[3] Bug 995610 - Add warnings for expression closures
[4] Bug 824289 - Hide for-each from web content
_______________________________________________
dev-tech-js-engine-internals mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals