pointer-alternative

JavaScript performance comparison

Test case created

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    data = {};
    data[0] = {};
    data[1] = "Lorem ipsum dolor sedet. Quem aldor edit iacem, qui et non coniunctivus. Ador videt aves. In hortum sedet. 'Ave, aves' dixit.";
    data[2] = 2;
   
    for (i=0; i<50; i++) {
     data[0][i] = 100 - i;
     data[1] += data[1];
     data[2] *= (i+1);
    }
   
    function testA(obj, count) {
     if (count > 0) {
      testA(obj, count-1);
     } else {
      var testVar = obj.toString();
     }
    }
    function testB(id, count) {
     if (count > 0) {
      testB(id, count-1);
     } else {
      var testVar = data[id].toString();
     }
    }
};
</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
No pointers
testA(data[0], 3);
testA(data[1], 3);
testA(data[2], 3);
pending…
With alternative pointers
testA(0, 3);
testA(1, 3);
testA(2, 3);
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