performance frozen object

JavaScript performance comparison

Revision 21 of this test case created by d

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var f1 = function() {};
    var f2 = function() {};
    var f3 = function() {};
   
    f1.prototype.test = function(arg) {
      this.doWork = arg;
    }
    f2.prototype.test = function(arg) {
      this.doWork = arg;
    }
    f3.prototype.test = function(arg) {
      this.doWork = arg;
    }
   
    Object.freeze(f2.prototype);
    Object.seal(f3.prototype);
   
    var o1 = new f1();
    var o2 = new f2();
    var o3 = new f3();
};
</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 object
o1.test(Math.random());
pending…
frozen object
o2.test(Math.random());
pending…
sealed prototype
o3.test(Math.random());
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