Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36
Chrome 91
Windows
Desktop
2 years ago
Test name Executions per second
Vanilla JS .innerText 1090527.0 Ops/sec
Vanilla JS .innerHTML 337105.3 Ops/sec
Vanilla JS .textContent 2913127.0 Ops/sec
Vanilla JS (QuerySelector) .innerText 889248.1 Ops/sec
Vanilla JS (QuerySelector) .innerHTML 301074.8 Ops/sec
Vanilla JS (QuerySelector) .textContent 1907491.0 Ops/sec
Vanilla JS (QuerySelectorAll) .innerText 1114454.0 Ops/sec
Vanilla JS (QuerySelectorAll) .innerHTML 1090448.0 Ops/sec
Vanilla JS (QuerySelectorAll) .textContent 1113430.0 Ops/sec
Cash .text 1554506.0 Ops/sec
Cash .html 281672.0 Ops/sec
jQuery .text() 494080.2 Ops/sec
jQuery .html() 243728.0 Ops/sec
jQuery .find() .text() 356527.1 Ops/sec
jQuery .find() .html() 199371.7 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()