Run details:
Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36
Chrome 81
Windows 8
Desktop
4 years ago
Test name Executions per second
Vanilla JS .innerText 483797.3 Ops/sec
Vanilla JS .innerHTML 93300.5 Ops/sec
Vanilla JS .textContent 1608591.5 Ops/sec
Vanilla JS (QuerySelector) .innerText 465411.3 Ops/sec
Vanilla JS (QuerySelector) .innerHTML 110164.7 Ops/sec
Vanilla JS (QuerySelector) .textContent 1266512.0 Ops/sec
Vanilla JS (QuerySelectorAll) .innerText 762175.9 Ops/sec
Vanilla JS (QuerySelectorAll) .innerHTML 747415.4 Ops/sec
Vanilla JS (QuerySelectorAll) .textContent 649391.4 Ops/sec
Cash .text 760592.8 Ops/sec
Cash .html 96116.0 Ops/sec
jQuery .text() 276403.2 Ops/sec
jQuery .html() 24790.3 Ops/sec
jQuery .find() .text() 207326.7 Ops/sec
jQuery .find() .html() 25082.1 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()