freeze vs seal vs normal

JavaScript performance comparison

Revision 2 of this test case created

Preparation code

<script>
  var o = {
    i: 42,
    s: "someString",
    n: null,
    r: /ocd/,
    a: [1,2,3],
    f: function(i) { return i; }
  }
 
  var seal = Object.seal(o);
 
  var frozen = Object.freeze(o);
</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
seal
var p = seal.i + seal.s + seal.n + seal.r;
seal.f(seal.a);
pending…
frozen
var q = frozen.i + frozen.s + frozen.n + frozen.r;
frozen.f(frozen.a);
pending…
normal
var r = o.i + o.s + o.n + o.r;
o.f(o.a);
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