Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36
Chrome 84
Mac OS X 10.15.5
Desktop
4 years ago
Test name Executions per second
Vanilla JS .innerText 903855.0 Ops/sec
Vanilla JS .innerHTML 208163.7 Ops/sec
Vanilla JS .textContent 2892576.8 Ops/sec
Vanilla JS (QuerySelector) .innerText 769054.4 Ops/sec
Vanilla JS (QuerySelector) .innerHTML 202248.5 Ops/sec
Vanilla JS (QuerySelector) .textContent 1796204.6 Ops/sec
Vanilla JS (QuerySelectorAll) .innerText 934293.9 Ops/sec
Vanilla JS (QuerySelectorAll) .innerHTML 948024.4 Ops/sec
Vanilla JS (QuerySelectorAll) .textContent 955551.5 Ops/sec
Cash .text 1551334.8 Ops/sec
Cash .html 184301.0 Ops/sec
jQuery .text() 490774.0 Ops/sec
jQuery .html() 162198.9 Ops/sec
jQuery .find() .text() 329692.3 Ops/sec
jQuery .find() .html() 129641.0 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()


;