Run details:
Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.1 Mobile/15E148 Safari/604.1
Mobile Safari 14
iOS 14.2
Mobile
3 years ago
Test name Executions per second
Vanilla JS .innerText 2980554.0 Ops/sec
Vanilla JS .innerHTML 1070888.9 Ops/sec
Vanilla JS .textContent 3166367.0 Ops/sec
Vanilla JS (QuerySelector) .innerText 2419226.2 Ops/sec
Vanilla JS (QuerySelector) .innerHTML 942931.2 Ops/sec
Vanilla JS (QuerySelector) .textContent 2539298.5 Ops/sec
Vanilla JS (QuerySelectorAll) .innerText 2530632.2 Ops/sec
Vanilla JS (QuerySelectorAll) .innerHTML 2346810.5 Ops/sec
Vanilla JS (QuerySelectorAll) .textContent 2304384.0 Ops/sec
Cash .text 1894482.4 Ops/sec
Cash .html 788708.7 Ops/sec
jQuery .text() 969874.6 Ops/sec
jQuery .html() 626170.4 Ops/sec
jQuery .find() .text() 668256.6 Ops/sec
jQuery .find() .html() 432109.6 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()


;