Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:79.0) Gecko/20100101 Firefox/79.0
Firefox 79
Mac OS X 10.15
Desktop
4 years ago
Test name Executions per second
Vanilla JS .innerText 1014771.0 Ops/sec
Vanilla JS .innerHTML 1310837.9 Ops/sec
Vanilla JS .textContent 1438904.4 Ops/sec
Vanilla JS (QuerySelector) .innerText 970009.2 Ops/sec
Vanilla JS (QuerySelector) .innerHTML 1253442.6 Ops/sec
Vanilla JS (QuerySelector) .textContent 1251290.5 Ops/sec
Vanilla JS (QuerySelectorAll) .innerText 368082.4 Ops/sec
Vanilla JS (QuerySelectorAll) .innerHTML 286048.6 Ops/sec
Vanilla JS (QuerySelectorAll) .textContent 325651.1 Ops/sec
Cash .text 1424510.1 Ops/sec
Cash .html 1344958.2 Ops/sec
jQuery .text() 909768.9 Ops/sec
jQuery .html() 951236.2 Ops/sec
jQuery .find() .text() 518706.6 Ops/sec
jQuery .find() .html() 507913.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()