Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit/604.3.5 (KHTML, like Gecko) Version/11.0.1 Safari/604.3.5
Safari 11
Mac OS X 10.13.1
Other
2025 years ago
Test name Executions per second
Pure JS .innerText 855678.5 Ops/sec
Pure JS .innerHTML 2811769.2 Ops/sec
Pure JS .textContent 5197186.0 Ops/sec
jQuery .text() 1898777.6 Ops/sec
jQuery .html() 1577684.5 Ops/sec
jQuery .find().text() 1134026.1 Ops/sec
jQuery .find().html() 1040733.1 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()


;