Increment vs Decrement 2

JavaScript performance comparison

Revision 2 of this test case created by zaus

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var values = [1,2,3,4,5];
    function process() {
    };
};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Increment
for (var i=0; i <= values.length - 1; i++) {
   process(values[i]);
}
pending…
Decrement
for (var i=values.length - 1; i >= 0; i--) {
   process(values[i]);
}
pending…
Increment, correct terminal
for (var i=0; i < values.length; i++) {
   process(values[i]);
}
pending…
Increment, memoized terminal
for (var i=0, end=values.length; i < end; i++) {
   process(values[i]);
}
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:

0 comments

Add a comment