google / google/closure-compiler

Replace array-join by native string concats

Open
#3,837 0 comments 1 reaction 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.