Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Replacing array
Replacing array with: - splice infinity - splice arr.length - length reset + push
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/121.0.0.0 Safari/537.36
Browser:
Chrome 121
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
splice array.length
4.9M/s
length 0
4.1M/s
splice Infinity
3.4M/s
View exact numbers
Test name
Executions per second
✓
splice array.length
4,859,192 Ops/sec
length 0
4,137,546 Ops/sec
splice Infinity
3,415,739 Ops/sec
Script Preparation code:
var arr = [...Array(10000)].map((_, i) => i + 1)
Tests:
splice Infinity
arr.splice(0, Infinity, ...[1,2,3])
splice array.length
arr.splice(0, arr.length, ...[1,2,3])
length 0
arr.length = 0 arr.push(...[1,2,3])