Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36
Chrome 63
Linux
Other
2025 years ago
Test name Executions per second
Pure JS .innerText 494806.5 Ops/sec
Pure JS .innerHTML 1358860.2 Ops/sec
Pure JS .textContent 2827669.0 Ops/sec
jQuery .text() 622250.1 Ops/sec
jQuery .html() 462312.2 Ops/sec
jQuery .find().text() 359178.8 Ops/sec
jQuery .find().html() 281811.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()