Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36
Chrome 92
Linux
Desktop
3 years ago
Test name Executions per second
Vanilla JS .innerText 449753.2 Ops/sec
Vanilla JS .innerHTML 127766.6 Ops/sec
Vanilla JS .textContent 1141406.9 Ops/sec
Vanilla JS (QuerySelector) .innerText 394333.6 Ops/sec
Vanilla JS (QuerySelector) .innerHTML 116587.0 Ops/sec
Vanilla JS (QuerySelector) .textContent 952464.9 Ops/sec
Vanilla JS (QuerySelectorAll) .innerText 772549.1 Ops/sec
Vanilla JS (QuerySelectorAll) .innerHTML 668916.9 Ops/sec
Vanilla JS (QuerySelectorAll) .textContent 479080.3 Ops/sec
Cash .text 623316.4 Ops/sec
Cash .html 111498.6 Ops/sec
jQuery .text() 204020.4 Ops/sec
jQuery .html() 86966.2 Ops/sec
jQuery .find() .text() 135496.7 Ops/sec
jQuery .find() .html() 74362.6 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()