Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36
Chrome 97
Mac OS X 10.15.7
Desktop
2 years ago
Test name Executions per second
Vanilla JS .innerText 290578.7 Ops/sec
Vanilla JS .innerHTML 167544.8 Ops/sec
Vanilla JS .textContent 2893126.8 Ops/sec
Vanilla JS (QuerySelector) .innerText 285484.6 Ops/sec
Vanilla JS (QuerySelector) .innerHTML 149796.1 Ops/sec
Vanilla JS (QuerySelector) .textContent 1813536.4 Ops/sec
Vanilla JS (QuerySelectorAll) .innerText 846477.6 Ops/sec
Vanilla JS (QuerySelectorAll) .innerHTML 1026216.6 Ops/sec
Vanilla JS (QuerySelectorAll) .textContent 893636.1 Ops/sec
Cash .text 1569058.1 Ops/sec
Cash .html 137073.0 Ops/sec
jQuery .text() 168187.1 Ops/sec
jQuery .html() 121474.9 Ops/sec
jQuery .find() .text() 149086.7 Ops/sec
jQuery .find() .html() 114768.3 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()