map vs arr (v13)

Revision 13 of this benchmark created on


Setup

var hash = {};
var m = new Map();
for(let i = 0; i < 100000; i++) {
  hash[`${i}`] = i;
  m.set(`${i}`, i);
}

Test runner

Ready to run.

Testing in
TestOps/sec
hash
let i = 10000
while (i > 0) {
	hash["8356"] = 0x010;
	i -= hash["8356"]
}
console.log(i, hash["8356"])
ready
set
let i = 10000
while (i > 0) {
	m.set("8356", 0x010);
	i -= m.get("8356")
}
console.log(i, m.get("8356"))
ready

Revisions

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