Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
array = [] vs array.length = 0
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36
Browser:
Chrome 142
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
4 months ago
Test name
Executions per second
array = []
9938955.0 Ops/sec
array length = 0
7463551.5 Ops/sec
Script Preparation code:
var arr = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
Tests:
array = []
arr = [] arr.push(...['a', 'b', 'c']);
array length = 0
arr.length = 0; arr.push(...['a', 'b', 'c']);