Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36
Chrome 83
Mac OS X 10.15.3
Desktop
4 years ago
Test name Executions per second
Vanilla JS .innerText 34596.8 Ops/sec
Vanilla JS .innerHTML 20468.6 Ops/sec
Vanilla JS .textContent 24103.7 Ops/sec
Vanilla JS (QuerySelector) .innerText 3518.8 Ops/sec
Vanilla JS (QuerySelector) .innerHTML 4079.0 Ops/sec
Vanilla JS (QuerySelector) .textContent 94803.3 Ops/sec
Vanilla JS (QuerySelectorAll) .innerText 3268.2 Ops/sec
Vanilla JS (QuerySelectorAll) .innerHTML 5293.8 Ops/sec
Vanilla JS (QuerySelectorAll) .textContent 18224.1 Ops/sec
Cash .text 5207.8 Ops/sec
Cash .html 2951.8 Ops/sec
jQuery .text() 1118.7 Ops/sec
jQuery .html() 1287.3 Ops/sec
jQuery .find() .text() 648.5 Ops/sec
jQuery .find() .html() 745.3 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()