Set vs WeakSet vs dictionary (v4)

Revision 4 of this benchmark created on


Setup

const dict = {foo:true};
const set = new Set("foo");
const weakSet = new WeakSet();
const weakKey = {};
weakSet.add(weakKey);
set.add(weakKey);

Test runner

Ready to run.

Testing in
TestOps/sec
dict
const bar = dict["foo"];
ready
set
const bar = set.has(weakKey);
ready
weakset
const bar = weakSet.has(weakKey);
ready

Revisions

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