Unrolled loops
JavaScript performance comparison
Info
It seems the latest and greatest JavaScript engines have catched up and loop unrolling is not as great a speedup as it once was. Still, both unrolled loop variants are 10% to 25% faster than the for loop on both Safari 5 and Chrome 5.
Preparation code
<script>
var a = 0;
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
For loop |
|
pending… |
Unrolled loop |
|
pending… |
Unrolled loop (1 statement) |
|
pending… |
Partial Unrolling |
|
pending… |
Larger Partial Unrolling |
|
pending… |
Compare results of other browsers
Revisions
You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:
- Revision 1: published by Thomas Fuchs
- Revision 2: published by elliottcable
- Revision 3: published by Kristof Neirynck
- Revision 4: published by Micheil Smith
- Revision 6: published by Ryan Tenney
- Revision 7: published by gonchuki
- Revision 8: published by TW
- Revision 11: published
0 comments