Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36
Chrome 114
Mac OS X 10.15.7
Desktop
one year ago
Test name Executions per second
Vanilla JS .innerText 817490.1 Ops/sec
Vanilla JS .innerHTML 3696379.8 Ops/sec
Vanilla JS .textContent 3740332.2 Ops/sec
Vanilla JS (querySelector) .innerText 807050.6 Ops/sec
Vanilla JS (querySelector) .innerHTML 2291603.0 Ops/sec
Vanilla JS (querySelector) .textContent 2339028.2 Ops/sec
Vanilla JS (querySelectorAll) .innerText 1688510.4 Ops/sec
Vanilla JS (querySelectorAll) .innerHTML 1800812.6 Ops/sec
Vanilla JS (querySelectorAll) .textContent 1834949.0 Ops/sec
Cash .text 960108.2 Ops/sec
Cash .html 1670316.2 Ops/sec
jQuery .text() 1564804.8 Ops/sec
jQuery .html() 1654632.1 Ops/sec
jQuery .find() .text() 881313.2 Ops/sec
jQuery .find() .html() 882753.3 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()