Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36
Chrome 84
Windows
Desktop
4 years ago
Test name Executions per second
Vanilla JS .innerText 920487.5 Ops/sec
Vanilla JS .innerHTML 271892.4 Ops/sec
Vanilla JS .textContent 2694519.8 Ops/sec
Vanilla JS (QuerySelector) .innerText 783785.8 Ops/sec
Vanilla JS (QuerySelector) .innerHTML 260941.2 Ops/sec
Vanilla JS (QuerySelector) .textContent 1829850.2 Ops/sec
Vanilla JS (QuerySelectorAll) .innerText 1113917.5 Ops/sec
Vanilla JS (QuerySelectorAll) .innerHTML 1131145.2 Ops/sec
Vanilla JS (QuerySelectorAll) .textContent 1132839.1 Ops/sec
Cash .text 1616167.2 Ops/sec
Cash .html 246095.4 Ops/sec
jQuery .text() 522290.4 Ops/sec
jQuery .html() 192971.4 Ops/sec
jQuery .find() .text() 335199.6 Ops/sec
jQuery .find() .html() 152209.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()


;