Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36
Chrome 84
Mac OS X 10.15.5
Desktop
4 years ago
Test name Executions per second
Vanilla JS .innerText 744422.9 Ops/sec
Vanilla JS .innerHTML 194479.6 Ops/sec
Vanilla JS .textContent 2448825.5 Ops/sec
Vanilla JS (QuerySelector) .innerText 668693.6 Ops/sec
Vanilla JS (QuerySelector) .innerHTML 189613.4 Ops/sec
Vanilla JS (QuerySelector) .textContent 1696639.6 Ops/sec
Vanilla JS (QuerySelectorAll) .innerText 759283.0 Ops/sec
Vanilla JS (QuerySelectorAll) .innerHTML 806140.6 Ops/sec
Vanilla JS (QuerySelectorAll) .textContent 803343.2 Ops/sec
Cash .text 1241995.4 Ops/sec
Cash .html 161898.9 Ops/sec
jQuery .text() 430619.7 Ops/sec
jQuery .html() 137410.2 Ops/sec
jQuery .find() .text() 276119.3 Ops/sec
jQuery .find() .html() 122332.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()


;