Hacker News new | past | comments | ask | show | jobs | submit login
What's the Fastest Way to Code a Loop in JavaScript? (sun.com)
23 points by d0mine on July 25, 2008 | hide | past | web | favorite | 4 comments



Beware: this is a microbenchmark. It tells you a little about the interpreter innards that get used for different kinds of syntax, but that's about it.

Unless you're writing tight loops over small data, though (e.g. doing cryptography in Javascript or whatnot) this is not where you will be seeing slowdowns. In the real world, performance analysis always needs to start with the data. Are the questions you are asking your data algorithmically fast? Are you failing to cache things that are expensive to compute and hurting performance? Are you incorrectly caching things that are easy to compute and hurting performance?

Those are the real problems. And they have nothing to do with for() vs. Array.forEach().


(Almost on topic)

There is a JavaScript meetup in London on the 13th of August.

http://javascript.meetup.com/3/


The benchmark is faulty but nonetheless informative.


this is potentially very useful info. In what ways is the benchmark wrong?




Registration is open for Startup School 2019. Classes start July 22nd.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: