Tests:
  • innerHTML

    x
     
    const el = document.createElement('div');
    el.innerHTML = `
        <h1>Heading</h1>
        <p>Paragraph 1</p>
        <p>Paragraph 2</p>
        <button>Button</button>
    `;
    document.documentElement.appendChild(el);
  • appendChild

     
    const el = document.createElement('div');
    const heading = document.createElement('h1');
    const para1 = document.createElement('p');
    const para2 = document.createElement('p');
    const button = document.createElement('button');
    heading.innerText = 'Heading';
    para1.innerText = 'Paragraph 1';
    para2.innerText = 'Paragraph 2';
    button.innerText = 'Button';
    el.appendChild(heading);
    el.appendChild(para1);
    el.appendChild(para2);
    el.appendChild(button);
    document.documentElement.appendChild(el);
  • documentFragment

     
    const fg = document.createDocumentFragment();
    const el = document.createElement('div');
    const heading = document.createElement('h1');
    const para1 = document.createElement('p');
    const para2 = document.createElement('p');
    const button = document.createElement('button');
    heading.innerText = 'Heading';
    para1.innerText = 'Paragraph 1';
    para2.innerText = 'Paragraph 2';
    button.innerText = 'Button';
    fg.appendChild(heading);
    fg.appendChild(para1);
    fg.appendChild(para2);
    fg.appendChild(button);
    el.appendChild(fg);
    document.documentElement.appendChild(el);
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    innerHTML
    appendChild
    documentFragment

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Android 13; Mobile; rv:109.0) Gecko/118.0 Firefox/118.0
Firefox Mobile 118 on Android
View result in a separate tab
Test name Executions per second
innerHTML 65425.1 Ops/sec
appendChild 65538.5 Ops/sec
documentFragment 39263.8 Ops/sec