Run details:
Mozilla/5.0 (X11; Fedora; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36
Chrome 89
Fedora
Desktop
3 years ago
Test name Executions per second
Vanilla JS .innerText 214232.4 Ops/sec
Vanilla JS .innerHTML 89398.3 Ops/sec
Vanilla JS .textContent 1708720.9 Ops/sec
Vanilla JS (QuerySelector) .innerText 178524.5 Ops/sec
Vanilla JS (QuerySelector) .innerHTML 83688.2 Ops/sec
Vanilla JS (QuerySelector) .textContent 1100684.4 Ops/sec
Vanilla JS (QuerySelectorAll) .innerText 600568.2 Ops/sec
Vanilla JS (QuerySelectorAll) .innerHTML 633147.9 Ops/sec
Vanilla JS (QuerySelectorAll) .textContent 632682.0 Ops/sec
Cash .text 869956.8 Ops/sec
Cash .html 78362.5 Ops/sec
jQuery .text() 100138.5 Ops/sec
jQuery .html() 64723.9 Ops/sec
jQuery .find() .text() 74485.8 Ops/sec
jQuery .find() .html() 52930.6 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()