freeze vs seal vs normal (v19)

Revision 19 of this benchmark created by Joshua Wise on


Preparation HTML

<script>
  var o = {
    i: 42,
    s: 3,
    n: 5,
    r: 7,
    a: [1,2,3],
    f: function(i) { return i; }
  };
  var f = {
    i: 42,
    s: 3,
    n: 5,
    r: 7,
    a: [1,2,3],
    f: function(i) { return i; }
  };
  var s = {
    i: 42,
    s: 3,
    n: 5,
    r: 7,
    a: [1,2,3],
    f: function(i) { return i; }
  };
  Object.seal(s);
  Object.freeze(f);
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
seal
var p = s.i + s.s + s.n + s.r + s.a[0] + s.a.push(1) + s.a.shift();
s.f(p);
ready
frozen
var q = f.i + f.s + f.n + f.r + f.a[0] + f.a.push(1) + f.a.shift();
f.f(q);
ready
normal
var r = o.i + o.s + o.n + o.r + o.a[0] + o.a.push(1) + o.a.shift();
o.f(r);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.