Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.106 Safari/537.36
Chrome 80
Mac OS X 10.15.3
Desktop
4 years ago
Test name Executions per second
Pure JS .innerText 950298.2 Ops/sec
Pure JS .innerHTML 158967.0 Ops/sec
Pure JS .textContent 3077980.2 Ops/sec
jQuery .text() 530774.1 Ops/sec
jQuery .html() 132892.3 Ops/sec
jQuery .find().text() 348552.8 Ops/sec
jQuery .find().html() 110110.9 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()