es6-map-shim-vs-transit-map

Benchmark created on


Preparation HTML

<script src="http://cdn.cognitect.com/transit/transit-0.8.616-min.js" type="text/javascript"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.11.0/es6-shim.min.js" type="text/javascript"></script>

Setup

var smallObject = {};
    for(var i = 0; i < 8; i++) {
      smallObject["foo"+i] = i;
    }
    
    var smallES6Map = new Map();
    for(var i = 0; i < 8; i++) {
      smallES6Map.set("foo"+i, i);
    }
    
    var smallTransitMap = transit.map();
    for(var i = 0; i < 8; i++) {
      smallTransitMap.set("foo"+i, i);
    }

Test runner

Ready to run.

Testing in
TestOps/sec
es6-shim Map set
var m = new Map();
for(var i = 0; i < 8; i++) {
  m.set("foo"+i, i);
}
ready
transit-js Map set
var m = transit.map();
for(var i = 0; i < 8; i++) {
  m.set("foo"+i, i);
}
ready
Object set
var o = {};
for(var i = 0; i < 8; i++) {
  o["foo"+i] = i;
}
ready
es6-shim Map has
for(var i = 0; i < 8; i++) {
  smallES6Map.has("foo"+i);
}
 
ready
transit map has
for(var i = 0; i < 8; i++) {
  smallTransitMap.has("foo"+i);
}
 
ready
Object hasOwnProperty
for(var i = 0; i < 8; i++) {
  smallObject.hasOwnProperty("foo"+i);
}
 
ready

Revisions

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