Run details:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0
Firefox 58
Ubuntu
Other
2025 years ago
Test name Executions per second
Pure JS .innerText 1235100.6 Ops/sec
Pure JS .innerHTML 1845818.6 Ops/sec
Pure JS .textContent 2055126.9 Ops/sec
jQuery .text() 1541918.1 Ops/sec
jQuery .html() 1512994.8 Ops/sec
jQuery .find().text() 572125.5 Ops/sec
jQuery .find().html() 545780.5 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()


;