Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
set vs weakset
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64; rv:132.0) Gecko/20100101 Firefox/132.0
Browser:
Firefox 132
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
set
1730523520.0 Ops/sec
weak set
55782488.0 Ops/sec
Script Preparation code:
var objs = Array(100).fill().map(() => { return {} }) var obj = objs[50] var set = new Set() var weakset = new WeakSet() var times = 100 while (times--) { set.add(objs[times]) weakset.add(objs[times]) }
Tests:
set
set.has(obj)
weak set
weakset.has(obj)