Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Comparing performance of: array length = 0 vs array = [] vs arra.splice(0)
(version: 1)
Comparing performance of:
array length = 0 vs array = [] vs array.splice(0)
Created:
9 months ago
by:
Guest
Go to the latest result
Script Preparation code:
var arr = [1,2,3,4];
Tests:
array length = 0
arr.length = 0
array = []
arr = []
array.splice(0)
arr.splice(0)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
array length = 0
array = []
array.splice(0)
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
9 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36
Browser/OS:
Chrome 142 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
array.splice(0)
52.3M/s
array length = 0
34.0M/s
array = []
9.7M/s
View exact numbers
Test name
Executions per second
✓
array.splice(0)
52,274,420 Ops/sec
array length = 0
33,980,488 Ops/sec
array = []
9,685,842 Ops/sec
Related benchmarks
slice vs length-1
empty an array in JavaScript - splice vs setting length faster
Array.splice(0, N) vs Array.length === N
array.length = 0 vs []
Comments
Confirm delete:
Do you really want to delete benchmark?