Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Splice vs Filter 2
(version: 1)
Comparing performance of:
Splice vs Filter
Created:
10 months ago
by:
Guest
Go to the latest result
Script Preparation code:
const arr = Array(500).fill(0).map(() => Math.floor(Math.random() * 1000000));
Tests:
Splice
const num = arr[Math.floor(Math.random() * 500)] const index = arr.find(item => item === num) if (index > -1) { arr.splice(index, 1) } arr.push(1)
Filter
const num = arr[Math.floor(Math.random() * 500)] const newArr = arr.filter(item => item !== num) newArr.push(1)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Splice
Filter
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
10 months ago
)
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36
Browser/OS:
Chrome 137 on Linux
View result in a separate tab
Embed
Embed Benchmark Result
Splice
21K/s
Filter
76/s
View exact numbers
Test name
Executions per second
✓
Splice
21,032 Ops/sec
Filter
76 Ops/sec
Related benchmarks
FindIndex + splice vs filter
Remove an item from array; indexOf + splice vs filter
Remove an item from array; indexOf + splice vs filter 2
JS filter vs splice +indexOf
Comments
Confirm delete:
Do you really want to delete benchmark?