frozen or not

Benchmark created on


Setup

function obj() {
      var x = {};
      for (var i = 0; i < 100; i++)
        x['v' + i] = i;
      return x;
    }
    
    function iterate(stuff) {
      for (var x in stuff) {
        var y = stuff[x];
      }
    }
    
    function forEachIterate(stuff) {
      Object.keys(stuff).forEach(function(x) {
        var y = stuff[x];
      });
    }
    
    var unfrozen = obj();
    var frozen = obj();
    Object.freeze(frozen);

Test runner

Ready to run.

Testing in
TestOps/sec
frozen for
iterate(frozen)
ready
frozen foreach
forEachIterate(frozen)
ready
unfrozen for
iterate(unfrozen)
ready
unfrozen foreach
forEachIterate(unfrozen)
ready

Revisions

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