Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
splice VS filter: filtering big list of elements
100k list
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/131.0.0.0 Safari/537.36 Edg/131.0.0.0
Browser:
Chrome 131
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
filter
12.2 Ops/sec
splice
5.4 Ops/sec
Script Preparation code:
var list = []; var filterOutList = [10, 100, 1000, 50000, 50100, 50200, 50300, 99999] for (var i = 0; i < 1000 * 1000; i++) { list.push(i); }
Tests:
filter
list = list.filter((el) => !filterOutList.includes(el))
splice
let i = 0 while(i < list.length) { if (filterOutList.includes(list[i])) { list.splice(i, 1) continue } i++ }