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

[memory] replace forEach with arrayFrom #1522

Merged

Conversation

lifeart
Copy link
Contributor

@lifeart lifeart commented Dec 7, 2023

Spillover PR from #1515 (comment)

Left: Original
Right: This change

image image

It seems we could have 10% memory usage improvement for large data sets.

@lifeart lifeart marked this pull request as ready for review December 7, 2023 08:28
Copy link
Contributor

@NullVoxPopuli NullVoxPopuli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

Does this have the same impact in firefox and safari?

@lifeart
Copy link
Contributor Author

lifeart commented Dec 7, 2023

@NullVoxPopuli I can't say because JS framework benchmark seems support only chrome.

But, using Array.from is definitely less hacky comparing to existing implementation (?micro optimisation?) and should win over years.

I think forEach here is used from IE11 support times.

image

@NullVoxPopuli
Copy link
Contributor

makes sense to me! thanks!

@NullVoxPopuli NullVoxPopuli merged commit bb7faf4 into glimmerjs:master Dec 7, 2023
5 checks passed
@lifeart lifeart deleted the memory-replace-each-with-array-from branch December 7, 2023 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants