Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Naive some vs using pop shortening
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0
Browser:
Chrome 125
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
naive compare
0.1 Ops/sec
compare with pop
0.1 Ops/sec
Script Preparation code:
var watched = []; var ignored = []; for(let i = 0; i < 100000; i++){watched.push({programId:Math.random()});} for(let i = 0; i < 100000; i++){ignored.push({programId:Math.random()});}
Tests:
naive compare
watched.filter(obj => { return !ignored.some(item => item.programId === obj.programId); });
compare with pop
watched.filter(wObj => !ignored.some((iObj, ndx) => { if (iObj.programId === wObj.programId) { ignored[ndx] = ignored.pop(); return true; } return false; }) );