emscripten-core / emscripten-core/emscripten
Use abbreviations for common JS symbols to save on code size
- Lingua principale
- C++
- Stelle
- 27.6k
- Fork
- 3.6k
- Merge medio
- 1g 14h
- PR unite (30g)
- 125
Descrizione
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.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Leggi prima shell.js e i pass esistenti di minificazione JavaScript, quindi esamina come un pass di ottimizzazione di Acorn attraverserebbe gli utilizzi dei simboli. Il lavoro è completo quando i simboli comuni ripetuti vengono abbreviati solo quando sono utilizzati, inclusi gli utilizzi nella shell e nel codice dell’utente, senza richiedere modifiche manuali al codice sorgente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript
- Ambito
- compilers, tooling
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100