HTML Preparation code:
Tests:
  • With createElement() and append()

  • With createElement() and appendChild()

  • With innerHTML and getElementById()

  • With innerHTML and getElementsByClassName()

  • With innerHTML and getElementsByTagName()

  • With innerHTML and querySelector()

  • With innerHTML and querySelectorAll()

  • With createElement() and outerHTML

  • With innerHTML and children[children.length - 1]

  • With innerHTML and lastChild

  • With innerHTML and lastElementChild

  • With createElement() and innerHTML

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    With createElement() and append()
    With createElement() and appendChild()
    With innerHTML and getElementById()
    With innerHTML and getElementsByClassName()
    With innerHTML and getElementsByTagName()
    With innerHTML and querySelector()
    With innerHTML and querySelectorAll()
    With createElement() and outerHTML
    With innerHTML and children[children.length - 1]
    With innerHTML and lastChild
    With innerHTML and lastElementChild
    With createElement() and innerHTML

    Fastest: N/A

    Slowest: N/A

Get performance results from real users on your website with Request Metrics.
Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:106.0) Gecko/20100101 Firefox/106.0
Firefox 106 on Windows
View result in a separate tab
Test name Executions per second
With createElement() and append() 701.9 Ops/sec
With createElement() and appendChild() 252.4 Ops/sec
With innerHTML and getElementById() 542786.3 Ops/sec
With innerHTML and getElementsByClassName() 476435.9 Ops/sec
With innerHTML and getElementsByTagName() 453142.8 Ops/sec
With innerHTML and querySelector() 462701.3 Ops/sec
With innerHTML and querySelectorAll() 387011.9 Ops/sec
With createElement() and outerHTML 330630.1 Ops/sec
With innerHTML and children[children.length - 1] 414557.2 Ops/sec
With innerHTML and lastChild 520841.1 Ops/sec
With innerHTML and lastElementChild 524433.1 Ops/sec
With createElement() and innerHTML 394358.5 Ops/sec