WeakMap vs Map

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
WeakMap
let john = { name: "John" };

let weakMap = new WeakMap();
weakMap.set(john, "...");

john = null;
ready
Map
let john = { name: "John" };

let map = new Map();
map.set(john, "...");

john = null;
ready

Revisions

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