Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36
Chrome 72
Mac OS X 10.14.2
Desktop
5 years ago
Test name Executions per second
Pure JS .innerText 593187.1 Ops/sec
Pure JS .innerHTML 1776080.5 Ops/sec
Pure JS .textContent 2962180.2 Ops/sec
jQuery .text() 1123670.2 Ops/sec
jQuery .html() 953670.2 Ops/sec
jQuery .find().text() 553126.9 Ops/sec
jQuery .find().html() 501204.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()