ES6 Map vs Object Get (v258)

Revision 258 of this benchmark created on


Description

(edited to get the set counterpart to revision 251 get)

Setup

var mapStr = new Map();
  var objStr = {};
  var mapNum = new Map();
  var objNum = {};

Test runner

Ready to run.

Testing in
TestOps/sec
[Number key] map.set
for (let i = 0; i < 10000; i++) {
    mapNum.set(i, Math.random());
}
ready
[String key] map.set
for (let i = 0; i < 10000; i++) {
    mapStr.set(`key_${i}`, Math.random());
}
ready
[Number key] obj[key] =
for (let i = 0; i < 10000; i++) {
    objNum[i] = Math.random();
}
ready
[String key] obj[key] =
for (let i = 0; i < 10000; i++) {
    objStr[`key_${i}`] = Math.random();
}
ready

Revisions

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