Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36 Edg/108.0.1462.54
Chrome 108
Windows
Desktop
one year ago
Test name Executions per second
Vanilla JS .innerText 907224.5 Ops/sec
Vanilla JS .innerHTML 249491.4 Ops/sec
Vanilla JS .textContent 2737979.5 Ops/sec
Vanilla JS (QuerySelector) .innerText 779282.8 Ops/sec
Vanilla JS (QuerySelector) .innerHTML 235538.1 Ops/sec
Vanilla JS (QuerySelector) .textContent 1681459.6 Ops/sec
Vanilla JS (QuerySelectorAll) .innerText 930257.0 Ops/sec
Vanilla JS (QuerySelectorAll) .innerHTML 908758.8 Ops/sec
Vanilla JS (QuerySelectorAll) .textContent 933875.8 Ops/sec
Cash .text 1047961.1 Ops/sec
Cash .html 215019.2 Ops/sec
jQuery .text() 461205.3 Ops/sec
jQuery .html() 234921.4 Ops/sec
jQuery .find() .text() 350080.7 Ops/sec
jQuery .find() .html() 205100.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()


;