Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36
Chrome 84
Mac OS X 10.15.5
Desktop
4 years ago
Test name Executions per second
Vanilla JS .innerText 187407.4 Ops/sec
Vanilla JS .innerHTML 98463.6 Ops/sec
Vanilla JS .textContent 2765626.2 Ops/sec
Vanilla JS (QuerySelector) .innerText 181222.0 Ops/sec
Vanilla JS (QuerySelector) .innerHTML 95802.1 Ops/sec
Vanilla JS (QuerySelector) .textContent 1778946.6 Ops/sec
Vanilla JS (QuerySelectorAll) .innerText 865303.4 Ops/sec
Vanilla JS (QuerySelectorAll) .innerHTML 966539.5 Ops/sec
Vanilla JS (QuerySelectorAll) .textContent 981953.0 Ops/sec
Cash .text 1601087.0 Ops/sec
Cash .html 59849.9 Ops/sec
jQuery .text() 56732.6 Ops/sec
jQuery .html() 55964.5 Ops/sec
jQuery .find() .text() 93186.1 Ops/sec
jQuery .find() .html() 50570.7 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()


;