Map Iteration

JavaScript performance comparison

Test case created

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var o = {};
    var m = new Map();
    var keys = ['foo', 'bar', 'test', 'case', 'bring', 'it', 'down'];
    var numKeys = keys.length;
    var n;
    for (n = 0; n < numKeys; n += 1)
    {
      o[keys[n]] = n;
      m[keys[n]] = n;
    }
};
</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
Object
var p, r;
r = 0;
for (p in o)
{
  r += o[p];
}
pending…
Map
var p, r;
r = 0;
for (p in m)
{
  r += m[p];
}
pending…

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

Compare results of other browsers

0 comments

Add a comment