Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0
Firefox 88
Windows
Desktop
3 years ago
Test name Executions per second
Vanilla JS .innerText 1464367.5 Ops/sec
Vanilla JS .innerHTML 3806403.8 Ops/sec
Vanilla JS .textContent 3235134.0 Ops/sec
Vanilla JS (querySelector) .innerText 1006010.4 Ops/sec
Vanilla JS (querySelector) .innerHTML 2017142.2 Ops/sec
Vanilla JS (querySelector) .textContent 2202545.8 Ops/sec
Vanilla JS (querySelectorAll) .innerText 747961.2 Ops/sec
Vanilla JS (querySelectorAll) .innerHTML 775694.1 Ops/sec
Vanilla JS (querySelectorAll) .textContent 793841.7 Ops/sec
Cash .text 3323880.2 Ops/sec
Cash .html 2048757.1 Ops/sec
jQuery .text() 1714825.1 Ops/sec
jQuery .html() 1681615.6 Ops/sec
jQuery .find() .text() 513251.9 Ops/sec
jQuery .find() .html() 491278.2 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()