Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Deduplicate 4
Improve perf of sort
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Android 14; Mobile; rv:135.0) Gecko/135.0 Firefox/135.0
Browser:
Firefox Mobile 135
Operating system:
Android
Device Platform:
Mobile
Date tested:
one year ago
Test name
Executions per second
Sort
75.8 Ops/sec
Set
56.4 Ops/sec
Tests:
Sort
let array = []; for (let i = 0; i < 100000; i++) { array.push(1); array.push(i); } array.sort((a, b) => a - b); let newArray = [array[0]]; for(let i = 1; i < array.length; i ++) { if(array[i-1] !== array[i]) { newArray.push(array[i]) } }
Set
const array = []; for (let i = 0; i < 100000; i++) { array.push(1); array.push(i); } const out = [...new Set(array)];