New Set vs. add

Benchmark created on


Setup

let x = new Set([])

Test runner

Ready to run.

Testing in
TestOps/sec
new Set
const val = x.size+1;
x = new Set([...x, val]);
ready
add Set
const val = x.size+1;
x.add(val);
ready

Revisions

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