Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Convert querySelectorAll to array + push
(version: 0)
Comparing performance of:
Array.prototype.slice.call vs [].slice.call vs ... vs push
Created:
5 years ago
by:
Registered User
Jump to the latest result
Script Preparation code:
maind = document.createElement('div'); for (let i = 0; i < 10000; i++) { let d = document.createElement('div'); maind.appendChild(d); } document.body.appendChild(maind);
Tests:
Array.prototype.slice.call
Array.prototype.slice.call( maind.querySelectorAll('div') );
[].slice.call
[].slice.call( maind.querySelectorAll('div') );
...
[...maind.querySelectorAll('div')]
push
a=[]; for(let i=0; i<10000; i++) { a.push(maind[i]); }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
Array.prototype.slice.call
[].slice.call
...
push
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
Test47
Convert querySelectorAll to array -
Array.from vs Spread with Node List DOM More
Spread vs Array.from on querySelectorAll
Comments
Confirm delete:
Do you really want to delete benchmark?