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

ridiculous speed gain with while #2

Closed
wants to merge 1 commit into from
Closed

ridiculous speed gain with while #2

wants to merge 1 commit into from

Conversation

fiatjaf
Copy link

@fiatjaf fiatjaf commented Jun 2, 2015

http://jsperf.com/immupdate-while-vs-foreach

if I were you I would never accept such a petulant pull request.

@AlexGalays
Copy link
Owner

forEach can't be as fast as a while or a for loop by design; Did you really encounter a bottleneck? That would be surprising!
I'm inclined to leave it as is, 28% faster in chrome while introducing a local variable isn't particularly sexy :p

@fiatjaf
Copy link
Author

fiatjaf commented Jun 7, 2015

No problem. No bottleneck. This was just an exercise.

But why is a local variable so bad?

@AlexGalays
Copy link
Owner

A local variable is not so bad, it's just that i'd rather have the equivalent code that doesn't use an extra variable if I can help it :)

@fiatjaf fiatjaf closed this Dec 29, 2015
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

Successfully merging this pull request may close these issues.

None yet

2 participants