Script Preparation code:
x
 
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>

Previous results

Experimental features:

  • Test case name Result
    batch clone
    singular clone
    querySelectorAll

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 3 months ago)
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
Chrome 131 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
batch clone 8531.8 Ops/sec
singular clone 7707.4 Ops/sec
querySelectorAll 8017.5 Ops/sec