Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36
Chrome 83
Mac OS X 10.14.1
Desktop
4 years ago
Test name Executions per second
Vanilla JS .innerText 802693.3 Ops/sec
Vanilla JS .innerHTML 167785.5 Ops/sec
Vanilla JS .textContent 2609394.5 Ops/sec
Vanilla JS (QuerySelector) .innerText 681437.4 Ops/sec
Vanilla JS (QuerySelector) .innerHTML 163876.7 Ops/sec
Vanilla JS (QuerySelector) .textContent 1615051.0 Ops/sec
Vanilla JS (QuerySelectorAll) .innerText 858374.3 Ops/sec
Vanilla JS (QuerySelectorAll) .innerHTML 919592.8 Ops/sec
Vanilla JS (QuerySelectorAll) .textContent 935400.2 Ops/sec
Cash .text 1448012.1 Ops/sec
Cash .html 149804.5 Ops/sec
jQuery .text() 420807.2 Ops/sec
jQuery .html() 121206.4 Ops/sec
jQuery .find() .text() 270963.0 Ops/sec
jQuery .find() .html() 103426.3 Ops/sec
HTML Preparation code:
Tests:
  • Vanilla JS .innerText

  • Vanilla JS .innerHTML

  • Vanilla JS .textContent

  • Vanilla JS (QuerySelector) .innerText

  • Vanilla JS (QuerySelector) .innerHTML

  • Vanilla JS (QuerySelector) .textContent

  • Vanilla JS (QuerySelectorAll) .innerText

  • Vanilla JS (QuerySelectorAll) .innerHTML

  • Vanilla JS (QuerySelectorAll) .textContent

  • Cash .text

  • Cash .html

  • jQuery .text()

  • jQuery .html()

  • jQuery .find() .text()

  • jQuery .find() .html()


;