performance frozen object

JavaScript performance comparison

Revision 18 of this test case created

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    a1 = [];
    a2 = [];
   
    for (i = 0; i < 1000; i++) {
   
      var o1 = {
        x: "vx",
        y: "vy"
      };
      var o2 = {
        x: "vx",
        y: "vy"
      };
   
      Object.freeze(o2);
   
      a1.push(o1);
      a2.push(o2);
    }
   
    Object.freeze(a2);
};
</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
non-frozen
var x = null;
var y = null;

for (i = 0; i < 1000; i++) {
  x = a1[i].x;
  y = a1[i].y;
}
pending…
frozen
var x = null;
var y = null;

for (i = 0; i < 1000; i++) {
  x = a2[i].x;
  y = a2[i].y;
}
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