Run details:
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36 OPR/42.0.2393.94
Opera 42
Windows
Other
7 years ago
Test name Executions per second
Pure JS .innerText 957052.3 Ops/sec
Pure JS .innerHTML 1741800.6 Ops/sec
Pure JS .textContent 3186061.8 Ops/sec
jQuery .text() 1071889.6 Ops/sec
jQuery .html() 823678.1 Ops/sec
jQuery .find().text() 566260.4 Ops/sec
jQuery .find().html() 461676.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()


;