Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36 Edg/80.0.361.66
Chrome 80
Mac OS X 10.15.3
Desktop
4 years ago
Test name Executions per second
Pure JS .innerText 265866.2 Ops/sec
Pure JS .innerHTML 61871.0 Ops/sec
Pure JS .textContent 1108646.9 Ops/sec
jQuery .text() 126298.9 Ops/sec
jQuery .html() 36029.7 Ops/sec
jQuery .find().text() 92971.5 Ops/sec
jQuery .find().html() 28096.6 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()