Skip to content

Conversation

@sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Dec 13, 2021

This a followup to #15763 which actually starts to use
some ES6 features in our core library code.

This change is designed to demonstrate that code size
wins that we can get from ES6 usage.

See: #11984

sbc100 added a commit that referenced this pull request Dec 13, 2021
Now that arrow functions and `let`/`const` are permitted in
emscripten JS library code we can take advantage of this to
reduce the size of the JS code that we output by default.

Followup to #15764

See: #11984
sbc100 added a commit that referenced this pull request Dec 13, 2021
Now that arrow functions and `let`/`const` are permitted in
emscripten JS library code we can take advantage of this to
reduce the size of the JS code that we output by default.

Followup to #15764

See: #11984
sbc100 added a commit that referenced this pull request Dec 13, 2021
Now that arrow functions and `let`/`const` are permitted in
emscripten JS library code we can take advantage of this to
reduce the size of the JS code that we output by default.

Followup to #15764

See: #11984
@sbc100 sbc100 changed the title [WIP] Initial usage of ES6 features Initial usage of ES6 features Dec 13, 2021
@sbc100 sbc100 requested a review from kripken December 13, 2021 20:16
@sbc100 sbc100 force-pushed the closure_transpile_only branch 3 times, most recently from 99827f4 to 0346d1c Compare December 13, 2021 21:09
Copy link
Member

@kripken kripken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting!

The main question for me here is closure. Closure advanced opts are fairly slow, as we know (though very much worth it!) - how fast is closure transpilation? We would be forcing people to use closure if they support older browsers, so an idea of the cost would be good.

Hopefully it's fast enough. Faster than other transpilation tools (Babel) would be good enough I think.

emcc.py Outdated
settings.TRANSPILE = (settings.MIN_FIREFOX_VERSION < 44 or
settings.MIN_CHROME_VERSION < 49 or
settings.MIN_SAFARI_VERSION < 11000 or
settings.MIN_IE_VERSION != 0x7FFFFFFF)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about Edge?

@sbc100 sbc100 force-pushed the closure_transpile_only branch 4 times, most recently from 3213444 to af6ba01 Compare December 14, 2021 06:40
With this change we allow these features by default.  If a user
explicitly opts into older browser support we trigger the running
of closure compiler with `--language_out ES5 --compilation_level
WHITESPACE_ONLY`.

For most users this will be a code size win, but otherwise a no-op.

For users who need older browser support they will now have their
output run though closure by default.  If they want to take a care
of the transpilaion process themselves rather than have emscripten
to it auto-magically they can run with `--closure=0`.

When we auto-magically run closure to do transpilation we generate
a warning.  This warning can be suppressed by add `--closure=1` to
explicitly opt in, or `--closure=0` to explicitly opt out.

This change in does not actually include any usage of these features
and so don't include the code size benefits. Those will be part of
followup PRs.

Fixes: #11984
This a followup to #15763 which actually starts to use
some ES6 features in our core library code.

This change is designed to demonstrate that code size
wins that we can get from ES6 usage.

See: #11984
@sbc100 sbc100 force-pushed the closure_transpile_only branch from af6ba01 to 1a9d0b5 Compare December 15, 2021 01:47
sbc100 added a commit that referenced this pull request Dec 15, 2021
Now that arrow functions and `let`/`const` are permitted in
emscripten JS library code we can take advantage of this to
reduce the size of the JS code that we output by default.

Followup to #15764

See: #11984
sbc100 added a commit that referenced this pull request Dec 15, 2021
Now that arrow functions and `let`/`const` are permitted in
emscripten JS library code we can take advantage of this to
reduce the size of the JS code that we output by default.

Followup to #15764

See: #11984
@sbc100 sbc100 force-pushed the closure_transpile_only branch 6 times, most recently from fe16954 to bc31c66 Compare December 18, 2021 00:59
Base automatically changed from closure_transpile_only to main December 18, 2021 02:02
@sbc100 sbc100 closed this Dec 22, 2021
@sbc100 sbc100 deleted the initial_es6 branch December 22, 2021 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants