Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:130.0) Gecko/20100101 Firefox/130.0
Firefox 130
Linux
Desktop
one year ago
Benchmark.js
With innerHTML and getElementById()
81K/s
With innerHTML and lastChild
80K/s
With innerHTML and lastElementChild
78K/s
With innerHTML and getElementsByTagName()
77K/s
With innerHTML and querySelector()
77K/s
With innerHTML and getElementsByClassName()
74K/s
With innerHTML and children[children.length - 1]
70K/s
With innerHTML and querySelectorAll()
68K/s
With createElement() and innerHTML
68K/s
With createElement() and outerHTML
67K/s
With createElement() and append()
1K/s
With createElement() and appendChild()
559/s
View exact numbers
Test name Executions per second
With innerHTML and getElementById() 80,814 Ops/sec
With innerHTML and lastChild 80,355 Ops/sec
With innerHTML and lastElementChild 77,864 Ops/sec
With innerHTML and getElementsByTagName() 77,459 Ops/sec
With innerHTML and querySelector() 77,210 Ops/sec
With innerHTML and getElementsByClassName() 74,097 Ops/sec
With innerHTML and children[children.length - 1] 69,530 Ops/sec
With innerHTML and querySelectorAll() 68,396 Ops/sec
With createElement() and innerHTML 68,205 Ops/sec
With createElement() and outerHTML 66,977 Ops/sec
With createElement() and append() 1,275 Ops/sec
With createElement() and appendChild() 559 Ops/sec
HTML Preparation code:
Tests: