Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
singular clone vs batch clone
(version: 6)
Comparing performance of:
batch clone vs singular clone vs querySelectorAll
Created:
one year ago
by:
Registered User
Jump to the latest result
Script Preparation code:
const DIV = document.createElement('div') const SPN = document.createElement('span') const BTN = document.createElement('button') const INP = document.createElement('input') const H2 = document.createElement('h2') const H4 = document.createElement('h4') const AX = document.createElement('a') const UL = document.createElement('ul') const LI = document.createElement('li')
Tests:
batch clone
let u0 = UL.cloneNode(true) let l0 = LI.cloneNode(true) let l1 = LI.cloneNode(true) let l2 = LI.cloneNode(true) u0.appendChild(l0) u0.appendChild(l1) u0.appendChild(l2) for (let i = 0; i < 200; ++i) { let ui = u0.cloneNode(true) let uj = ui.firstElementChild; let uk = uj.nextElementSibling; let ul = uk.nextElementSibling; }
singular clone
for (let i = 0; i < 200; ++i) { let u0 = UL.cloneNode(true) let l0 = LI.cloneNode(true) let l1 = LI.cloneNode(true) let l2 = LI.cloneNode(true) u0.appendChild(l0) u0.appendChild(l1) u0.appendChild(l2) }
querySelectorAll
let u0 = UL.cloneNode(true) let l0 = LI.cloneNode(true) let l1 = LI.cloneNode(true) let l2 = LI.cloneNode(true) u0.appendChild(l0) u0.appendChild(l1) u0.appendChild(l2) l0.dataset.f00='1'; l1.dataset.f00='2'; l2.dataset.f00='3'; for (let i = 0; i < 200; ++i) { let ui = u0.cloneNode(true) let uj = ui.querySelectorAll('[data-f00]'); }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
batch clone
singular clone
querySelectorAll
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Browser/OS:
Chrome 131 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
batch clone
8531.8 Ops/sec
singular clone
7707.4 Ops/sec
querySelectorAll
8017.5 Ops/sec
Related benchmarks:
Hepp hepp
Clone node vs create element
clone div vs clone form
range vs for nodes v3
clone vs inner
Create div template
Create versus clone element
createElement vs cloneNode customcustomcustomcustom
weweewdwr4
Comments
Confirm delete:
Do you really want to delete benchmark?