Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
FindIndex + splice vs filter
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (iPhone; CPU iPhone OS 18_1_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/131.0.6778.154 Mobile/15E148 Safari/604.1
Browser:
Chrome Mobile iOS 131
Operating system:
iOS 18.1.1
Device Platform:
Mobile
Date tested:
one year ago
filter
65.0M/s
FindIndex + splice
62.3M/s
View exact numbers
Test name
Executions per second
✓
filter
64,961,480 Ops/sec
FindIndex + splice
62,261,624 Ops/sec
Script Preparation code:
var arr = new Array(15000); arr.fill({ id: 0 }); arr = arr.map((el, idx) => el.id = idx); var foo = Math.floor(Math.random() * 15000);
Tests:
FindIndex + splice
var index = arr.indexOf(foo); var newArr = arr.splice(index, 1);
filter
var index = arr.filter(el => el !== foo)