Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36
Chrome 87
Mac OS X 10.15.7
Desktop
3 years ago
Test name Executions per second
Vanilla JS .innerText 1012810.7 Ops/sec
Vanilla JS .innerHTML 288730.3 Ops/sec
Vanilla JS .textContent 2833818.8 Ops/sec
Vanilla JS (QuerySelector) .innerText 818264.5 Ops/sec
Vanilla JS (QuerySelector) .innerHTML 266385.8 Ops/sec
Vanilla JS (QuerySelector) .textContent 1724867.0 Ops/sec
Vanilla JS (QuerySelectorAll) .innerText 1004230.4 Ops/sec
Vanilla JS (QuerySelectorAll) .innerHTML 1006116.4 Ops/sec
Vanilla JS (QuerySelectorAll) .textContent 1073674.4 Ops/sec
Cash .text 1623157.9 Ops/sec
Cash .html 252170.7 Ops/sec
jQuery .text() 531450.6 Ops/sec
jQuery .html() 215042.2 Ops/sec
jQuery .find() .text() 360953.7 Ops/sec
jQuery .find() .html() 177893.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()


;