1D VS 2D

JavaScript performance comparison

Test case created by Sadiquo

Info

1D VS 2D

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var array1 = [1, 2, 3, 4, 5, 6, 7, 9],
        array2 = [
        [1, 2, 3],
        [4, 5, 6],
        [7, 8, 9]
        ],
        i, e;
};
</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
1D
for (i = 0; i < 10; i++) {
  console.log(array1[i]);
}
pending…
2D
for (i = 0; i < 3; i++) {
  for (e = 0; e < 3; e++) {
    console.log(array2[i][e]);
  }
}
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