Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36
Chrome 83
Mac OS X 10.15.4
Desktop
4 years ago
Test name Executions per second
Vanilla JS .innerText 935790.9 Ops/sec
Vanilla JS .innerHTML 253988.1 Ops/sec
Vanilla JS .textContent 3078391.2 Ops/sec
Vanilla JS (QuerySelector) .innerText 811549.9 Ops/sec
Vanilla JS (QuerySelector) .innerHTML 238735.6 Ops/sec
Vanilla JS (QuerySelector) .textContent 1917351.1 Ops/sec
Vanilla JS (QuerySelectorAll) .innerText 1011665.6 Ops/sec
Vanilla JS (QuerySelectorAll) .innerHTML 1016497.9 Ops/sec
Vanilla JS (QuerySelectorAll) .textContent 1011046.2 Ops/sec
Cash .text 1643021.0 Ops/sec
Cash .html 219227.0 Ops/sec
jQuery .text() 537954.9 Ops/sec
jQuery .html() 184278.4 Ops/sec
jQuery .find() .text() 350954.2 Ops/sec
jQuery .find() .html() 161816.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()


;