Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
filter vs splice index
See if filter is faster than splice method for deletion
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0
Browser:
Firefox 128
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Filter
137669.5 Ops/sec
Splice
143013.9 Ops/sec
Tests:
Filter
let array = [1,2,3,4,5,6,7,8] const ignore = [2,4,7] array = array.filter(item => !ignore.includes(item)); console.log(array);
Splice
let array = [1,2,3,4,5,6,7,8] const ignore = [2,4,7] for(i = 0; i < array.length; i++) { if(ignore.includes(array[i])) { array.splice(i,1); i--; } } console.log(array);