Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace array-join by native string concats #3837

Open
infusion opened this issue Jun 25, 2021 · 0 comments
Open

Replace array-join by native string concats #3837

infusion opened this issue Jun 25, 2021 · 0 comments

Comments

@infusion
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant