Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:92.0) Gecko/20100101 Firefox/92.0
Firefox 92
Linux
Desktop
3 years ago
Test name Executions per second
Vanilla JS .innerText 119105.9 Ops/sec
Vanilla JS .innerHTML 184105.5 Ops/sec
Vanilla JS .textContent 187150.2 Ops/sec
Vanilla JS (QuerySelector) .innerText 132831.8 Ops/sec
Vanilla JS (QuerySelector) .innerHTML 24347.0 Ops/sec
Vanilla JS (QuerySelector) .textContent 13048.0 Ops/sec
Vanilla JS (QuerySelectorAll) .innerText 10321.1 Ops/sec
Vanilla JS (QuerySelectorAll) .innerHTML 243885.8 Ops/sec
Vanilla JS (QuerySelectorAll) .textContent 250185.5 Ops/sec
Cash .text 165630.8 Ops/sec
Cash .html 166271.8 Ops/sec
jQuery .text() 94836.6 Ops/sec
jQuery .html() 2429.4 Ops/sec
jQuery .find() .text() 66838.6 Ops/sec
jQuery .find() .html() 78718.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()