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/138.0.0.0 Safari/537.36 OPR/122.0.0.0
Browser:
Opera 122
Operating system:
Windows
Device Platform:
Desktop
Date tested:
7 months ago
Test name
Executions per second
filter
43.6 Ops/sec
splice
78.0 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++ }