google / google/closure-compiler
Replace array-join by native string concats
Open
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
Hello,
as closure compiler optimizes for a good gzip compression ratio and a trivial benchmark revealed a 28x performance increase on v8 and couple percent on Firefox by replacing
```
[a, b, c].join(" ")
```
with
```
a + " " + b + " " + c
```
I would propose to transform the array-join approach (which is much more readable, easier to type and often used in libraries) to a more verbose native string concat. This provokes a bigger uncompressed file, but generates nice repeated patterns for gzip.
Thanks Robert
Contributor guide
Assessment
This issue has not been assessed yet.