Adding to a Set vs Pushing to an Array

Benchmark created by BretCameron on


Setup

let arr = [], set = new Set(), n = 1000000;

Test runner

Ready to run.

Testing in
TestOps/sec
Adding to a Set
set.add(n);
ready
Pushing to an Array
arr.push(n);
ready

Revisions

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

  • Revision 1: published by BretCameron on