Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36
Chrome 92
Linux
Desktop
3 years ago
Test name Executions per second
Vanilla JS .innerText 272903.0 Ops/sec
Vanilla JS .innerHTML 67804.7 Ops/sec
Vanilla JS .textContent 961574.2 Ops/sec
Vanilla JS (QuerySelector) .innerText 169441.3 Ops/sec
Vanilla JS (QuerySelector) .innerHTML 61500.0 Ops/sec
Vanilla JS (QuerySelector) .textContent 550300.3 Ops/sec
Vanilla JS (QuerySelectorAll) .innerText 304635.9 Ops/sec
Vanilla JS (QuerySelectorAll) .innerHTML 302002.8 Ops/sec
Vanilla JS (QuerySelectorAll) .textContent 334050.6 Ops/sec
Cash .text 511008.3 Ops/sec
Cash .html 56146.0 Ops/sec
jQuery .text() 96992.5 Ops/sec
jQuery .html() 43760.4 Ops/sec
jQuery .find() .text() 67800.2 Ops/sec
jQuery .find() .html() 32529.2 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()