Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36
Chrome 86
Mac OS X 10.14.6
Desktop
3 years ago
Test name Executions per second
Vanilla JS .innerText 150626.7 Ops/sec
Vanilla JS .innerHTML 87235.2 Ops/sec
Vanilla JS .textContent 2211435.8 Ops/sec
Vanilla JS (QuerySelector) .innerText 144410.6 Ops/sec
Vanilla JS (QuerySelector) .innerHTML 75876.4 Ops/sec
Vanilla JS (QuerySelector) .textContent 1492963.2 Ops/sec
Vanilla JS (QuerySelectorAll) .innerText 790893.3 Ops/sec
Vanilla JS (QuerySelectorAll) .innerHTML 817509.4 Ops/sec
Vanilla JS (QuerySelectorAll) .textContent 803834.9 Ops/sec
Cash .text 1250657.1 Ops/sec
Cash .html 54085.7 Ops/sec
jQuery .text() 45147.6 Ops/sec
jQuery .html() 45403.0 Ops/sec
jQuery .find() .text() 39615.5 Ops/sec
jQuery .find() .html() 45305.7 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()


;