Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36
Chrome 83
Mac OS X 10.15.5
Desktop
4 years ago
Test name Executions per second
Vanilla JS .innerText 41048.4 Ops/sec
Vanilla JS .innerHTML 9371.5 Ops/sec
Vanilla JS .textContent 2584293.8 Ops/sec
Vanilla JS (QuerySelector) .innerText 99907.4 Ops/sec
Vanilla JS (QuerySelector) .innerHTML 44735.0 Ops/sec
Vanilla JS (QuerySelector) .textContent 1541670.4 Ops/sec
Vanilla JS (QuerySelectorAll) .innerText 778422.2 Ops/sec
Vanilla JS (QuerySelectorAll) .innerHTML 761210.5 Ops/sec
Vanilla JS (QuerySelectorAll) .textContent 740819.0 Ops/sec
Cash .text 1374506.9 Ops/sec
Cash .html 26575.8 Ops/sec
jQuery .text() 15493.6 Ops/sec
jQuery .html() 28080.5 Ops/sec
jQuery .find() .text() 31440.4 Ops/sec
jQuery .find() .html() 39832.0 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()