Run details:
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.76 Safari/537.36 OPR/43.0.2442.806
Opera 43
Windows
Other
7 years ago
Test name Executions per second
Pure JS .innerText 881626.2 Ops/sec
Pure JS .innerHTML 1681043.1 Ops/sec
Pure JS .textContent 2857573.5 Ops/sec
jQuery .text() 1045112.9 Ops/sec
jQuery .html() 828596.6 Ops/sec
jQuery .find().text() 595948.3 Ops/sec
jQuery .find().html() 510816.8 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()