-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Open
Description
I notices that there are cases where use common JavaScript symbols (e.g. Object.assign) multiple times in a single program and non of our current minification passes (including closure compiler) are able to remove or reduce the duplication of these strings.
Admittedly, gzip will can probably do a good job here, but we can't fully depend on that.
I tried creating simple change where I add common abbreviations to shell.js e.g.:
var assign = Object.assign;
..etc
However this has some downsides. Notably:
- It always includes these even if they are not used. We cannot use library dependencies here because some of the usages are in the shell itself which comes before any library symbol is included.
- The usages would all need to be changed from some thing well-known to something not well-known. This decreases maintainability and makes debugging harder. It also means that user-code that uses these symbols would need to be updated too or would not benefit.
Proposed solution: Add a new acorn optimizer pass that can find all the usages of these symbols and inject the abbreviations in the right place.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels