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:
8 months ago
Array.splice
27K/s
Array.filter
12K/s
View exact numbers
Test name
Executions per second
✓
Array.splice
26,890 Ops/sec
Array.filter
11,958 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;