The loops
JavaScript performance comparison
Info
Is the "reverse while" really faster than a normal for loop? And if yes, how much?
Preparation code
<script>
Benchmark.prototype.setup = function() {
var iterations2 = 100,
a = 0,
i, iterations;
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
while, ne, subtraction |
|
pending… |
while, ne, addition |
|
pending… |
for-loop, lt, addition |
|
pending… |
for-loop, ne, addition |
|
pending… |
for-loop, gt, subtraction |
|
pending… |
for-loop, ne, subtraction |
|
pending… |
while, gt, subtraction |
|
pending… |
while, lt, addition |
|
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 Barbara Cassani
- Revision 2: published
- Revision 4: published
- Revision 5: published
- Revision 6: published by JSON or escape
- Revision 7: published by Matt Lunn
- Revision 8: published
- Revision 11: published
- Revision 12: published by JSON or escape
- Revision 13: published
- Revision 14: published by JSON or escape
- Revision 15: published
- Revision 16: published
- Revision 17: published
- Revision 18: published by Tyler Young
- Revision 19: published by Barbara Cassani
- Revision 20: published by Barbara Cassani
- Revision 21: published
- Revision 22: published
0 comments