Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36
Chrome 83
Mac OS X 10.14.6
Desktop
4 years ago
Test name Executions per second
Vanilla JS .innerText 822617.6 Ops/sec
Vanilla JS .innerHTML 193334.6 Ops/sec
Vanilla JS .textContent 2579794.5 Ops/sec
Vanilla JS (QuerySelector) .innerText 694523.4 Ops/sec
Vanilla JS (QuerySelector) .innerHTML 198760.0 Ops/sec
Vanilla JS (QuerySelector) .textContent 1630933.1 Ops/sec
Vanilla JS (QuerySelectorAll) .innerText 854542.7 Ops/sec
Vanilla JS (QuerySelectorAll) .innerHTML 844100.6 Ops/sec
Vanilla JS (QuerySelectorAll) .textContent 847037.1 Ops/sec
Cash .text 1403483.4 Ops/sec
Cash .html 178565.3 Ops/sec
jQuery .text() 439262.2 Ops/sec
jQuery .html() 148899.0 Ops/sec
jQuery .find() .text() 260483.3 Ops/sec
jQuery .find() .html() 118542.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()


;