Loop test

Benchmark created on


Description

Perf

Test runner

Ready to run.

Testing in
TestOps/sec
Loop 1 million and uniq
var arr = [];
for (let i = 0; i <= 1000000; i += 1) {
  arr.push(Math.floor(10000 * Math.random()));
}
arr = [...new Set(arr)];
console.log(arr.length, 'unique values');
ready
Loop 1 million no uniq
var arr = [];
for (let i = 0; i <= 10000; i += 1) {
  arr.push(Math.floor(10000 * Math.random()));
}
console.log(arr.length, 'non-unique values');
ready

Revisions

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