Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36
Chrome 80
Mac OS X 10.14.6
Desktop
4 years ago
Test name Executions per second
Vanilla JS .innerText 474815.9 Ops/sec
Vanilla JS .innerHTML 108691.6 Ops/sec
Vanilla JS .textContent 2785416.2 Ops/sec
Vanilla JS (QuerySelector) .innerText 380365.1 Ops/sec
Vanilla JS (QuerySelector) .innerHTML 98104.8 Ops/sec
Vanilla JS (QuerySelector) .textContent 1623789.9 Ops/sec
Vanilla JS (QuerySelectorAll) .innerText 802842.3 Ops/sec
Vanilla JS (QuerySelectorAll) .innerHTML 791585.5 Ops/sec
Vanilla JS (QuerySelectorAll) .textContent 816996.2 Ops/sec
Cash .text 1146378.5 Ops/sec
Cash .html 83589.3 Ops/sec
jQuery .text() 217970.1 Ops/sec
jQuery .html() 53102.7 Ops/sec
jQuery .find() .text() 157681.1 Ops/sec
jQuery .find() .html() 44732.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()


;