array reverse test

JavaScript performance comparison

Test case created by qpayct

Preparation code

<div id='result'></div>
    

Preparation code output

<div id='result'></div>

Test runner

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

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
Built in reverse
var arr = [0,1,2,3,4,5,6,7,8,9];
arr.reverse();
document.getElementById('result').innerHTML = (arr);
pending…
Custom reverse
var arr = [0,1,2,3,4,5,6,7,8,9];
var temp;
for(var i=0,j=arr.length-1; i<j; i++,j--)
{
    temp = arr[j];
    arr[j] = arr[i];
    arr[i] = temp;
}
document.getElementById('result').innerHTML = (arr);
pending…

You can edit these tests or add even more tests to this page by appending /edit to the URL.

Compare results of other browsers

0 Comments