Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Splice vs Filter 2
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36
Browser:
Chrome 137
Operating system:
Linux
Device Platform:
Desktop
Date tested:
7 months ago
Test name
Executions per second
Splice
21031.9 Ops/sec
Filter
76.2 Ops/sec
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)