Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Array.filter vs Array.splice
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:145.0) Gecko/20100101 Firefox/145.0
Browser:
Firefox 145
Operating system:
Windows
Device Platform:
Desktop
Date tested:
4 months ago
Test name
Executions per second
Array.filter
11958.3 Ops/sec
Array.splice
26890.3 Ops/sec
Script Preparation code:
const array = Array.from({length: 10_000}, () => Math.floor(Math.random() * 10_000_000)); const indexToDelete = 7500; const deleteCount = 500;
Tests:
Array.filter
const temp = [...array]; return temp.filter((x, i) => i < indexToDelete || i >= indexToDelete + deleteCount);
Array.splice
const temp = [...array]; temp.splice(indexToDelete, deleteCount); return temp;