Run details:
Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.2 Mobile/15E148 Safari/604.1
Mobile Safari 14
iOS 14.3
Mobile
3 years ago
Test name Executions per second
Vanilla JS .innerText 2801170.2 Ops/sec
Vanilla JS .innerHTML 1096502.1 Ops/sec
Vanilla JS .textContent 3232478.8 Ops/sec
Vanilla JS (QuerySelector) .innerText 2396887.8 Ops/sec
Vanilla JS (QuerySelector) .innerHTML 947691.2 Ops/sec
Vanilla JS (QuerySelector) .textContent 2199955.5 Ops/sec
Vanilla JS (QuerySelectorAll) .innerText 198557.3 Ops/sec
Vanilla JS (QuerySelectorAll) .innerHTML 1759865.8 Ops/sec
Vanilla JS (QuerySelectorAll) .textContent 1806045.6 Ops/sec
Cash .text 1179962.0 Ops/sec
Cash .html 463849.4 Ops/sec
jQuery .text() 635121.5 Ops/sec
jQuery .html() 397674.7 Ops/sec
jQuery .find() .text() 445231.1 Ops/sec
jQuery .find() .html() 306224.5 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()