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 909042.4 Ops/sec
Vanilla JS .innerHTML 1049436.4 Ops/sec
Vanilla JS .textContent 1213873.4 Ops/sec
Vanilla JS (QuerySelector) .innerText 866590.1 Ops/sec
Vanilla JS (QuerySelector) .innerHTML 1116298.0 Ops/sec
Vanilla JS (QuerySelector) .textContent 1145509.6 Ops/sec
Vanilla JS (QuerySelectorAll) .innerText 513384.5 Ops/sec
Vanilla JS (QuerySelectorAll) .innerHTML 505024.7 Ops/sec
Vanilla JS (QuerySelectorAll) .textContent 506775.2 Ops/sec
Cash .text 1436852.8 Ops/sec
Cash .html 1247665.6 Ops/sec
jQuery .text() 911459.0 Ops/sec
jQuery .html() 958236.4 Ops/sec
jQuery .find() .text() 487406.0 Ops/sec
jQuery .find() .html() 497749.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()


;