Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36
Chrome 102
Mac OS X 10.15.7
Desktop
2 years ago
Test name Executions per second
Vanilla JS .innerText 792177.7 Ops/sec
Vanilla JS .innerHTML 285243.1 Ops/sec
Vanilla JS .textContent 1736910.8 Ops/sec
Vanilla JS (QuerySelector) .innerText 580744.5 Ops/sec
Vanilla JS (QuerySelector) .innerHTML 235414.3 Ops/sec
Vanilla JS (QuerySelector) .textContent 1028979.9 Ops/sec
Vanilla JS (QuerySelectorAll) .innerText 615940.2 Ops/sec
Vanilla JS (QuerySelectorAll) .innerHTML 637465.2 Ops/sec
Vanilla JS (QuerySelectorAll) .textContent 638463.6 Ops/sec
Cash .text 903160.7 Ops/sec
Cash .html 206983.7 Ops/sec
jQuery .text() 314295.2 Ops/sec
jQuery .html() 160892.6 Ops/sec
jQuery .find() .text() 241821.6 Ops/sec
jQuery .find() .html() 139200.9 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()


;