arraysize fnagel

JavaScript performance comparison

Test case created

Preparation code

        <script type="text/javascript">

                var arr = [],
                        x = 8,
                        y = 6;

                while(x){
                        arr[x] = [];
                        var y2 = y;
                        while(y2){
                                arr[x][y2] = Math.round(Math.random());
                                y2--;
                        }
                        x--;
                }
    console.log('ok');
</script>
 

Preparation code output

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
s1
var test = arr[5][7];
pending…
s2
var xrand = Math.round(Math.random() * (x - 1) + 1);
var yrand = Math.round(Math.random() * (y - 1) + 1);
var test = arr[xrand][yrand];
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

Add a comment