Array vs Set - create from big JSON

Benchmark created on


Setup

const SIZE = 100000;
const ids = Array.from({ length: SIZE }, (_, i) => i + 1);
const json = JSON.stringify(ids);

Test runner

Ready to run.

Testing in
TestOps/sec
Array
const array = JSON.parse(json);
ready
Set
const set = new Set(JSON.parse(json));
ready

Revisions

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