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 910211.8 Ops/sec
Vanilla JS .innerHTML 209817.2 Ops/sec
Vanilla JS .textContent 2798448.5 Ops/sec
Vanilla JS (QuerySelector) .innerText 782254.6 Ops/sec
Vanilla JS (QuerySelector) .innerHTML 214751.3 Ops/sec
Vanilla JS (QuerySelector) .textContent 1849239.9 Ops/sec
Vanilla JS (QuerySelectorAll) .innerText 985189.8 Ops/sec
Vanilla JS (QuerySelectorAll) .innerHTML 985265.1 Ops/sec
Vanilla JS (QuerySelectorAll) .textContent 922626.6 Ops/sec
Cash .text 1585040.2 Ops/sec
Cash .html 205649.7 Ops/sec
jQuery .text() 511614.0 Ops/sec
jQuery .html() 176382.0 Ops/sec
jQuery .find() .text() 332960.6 Ops/sec
jQuery .find() .html() 143295.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()


;