You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature request: add support for the Google Closure Compiler #10450
When used with -O=ADVANCED, the Google Closure Compiler can apply known optimizations to the code to improve performance. It seems that some performance fixes are as simple as inlining a function (eg. #5127), and the Closure Compiler could automate these with a build step.
The problem with this is that you end up with unreadable and possibly incorrect output (if dead code elimination made bad assumptions). At the very least this would affect stack traces.
The problem of lack of readability would be fixed by using source maps, which however aren't supported in Node.js (I couldn't find why, though); the problem of incorrect output relies on the solidity of the Closure Compiler, the correctness of manual type hints, and having complete coverage in regression tests.
Assuming we're talking about running the Closure Compiler on the JavaScript code in Node core, what would the upside be to automating things? It should be pretty easy to run the compiler against Node, see what optimisations it suggests, and then open PRs to add them to Node. That way we can make sure we trust the proposed optimisations (and not have to rerun the compiler all the time).
Reacted by Jeremiah Senkpiel, Evan Lucas and Anna Henningsen
I’m going to close this as question that was answered by the last comment … if you feel there’s more to be done here, opening a PR that adds support for this might be the best idea. Feel free to reopen or ask follow-up questions, if you have any. :)
Activity
mscdex commentedon Dec 25, 2016
The problem with this is that you end up with unreadable and possibly incorrect output (if dead code elimination made bad assumptions). At the very least this would affect stack traces.
CapacitorSet commentedon Dec 25, 2016
The problem of lack of readability would be fixed by using source maps, which however aren't supported in Node.js (I couldn't find why, though); the problem of incorrect output relies on the solidity of the Closure Compiler, the correctness of manual type hints, and having complete coverage in regression tests.
gibfahn commentedon Dec 28, 2016
Assuming we're talking about running the Closure Compiler on the JavaScript code in Node core, what would the upside be to automating things? It should be pretty easy to run the compiler against Node, see what optimisations it suggests, and then open PRs to add them to Node. That way we can make sure we trust the proposed optimisations (and not have to rerun the compiler all the time).
addaleax commentedon Apr 29, 2017
I’m going to close this as question that was answered by the last comment … if you feel there’s more to be done here, opening a PR that adds support for this might be the best idea. Feel free to reopen or ask follow-up questions, if you have any. :)