Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36
Chrome 87
Mac OS X 11.1.0
Desktop
3 years ago
Test name Executions per second
Vanilla JS .innerText 870748.8 Ops/sec
Vanilla JS .innerHTML 247204.5 Ops/sec
Vanilla JS .textContent 2631325.0 Ops/sec
Vanilla JS (QuerySelector) .innerText 743197.6 Ops/sec
Vanilla JS (QuerySelector) .innerHTML 250294.0 Ops/sec
Vanilla JS (QuerySelector) .textContent 1740763.5 Ops/sec
Vanilla JS (QuerySelectorAll) .innerText 980696.0 Ops/sec
Vanilla JS (QuerySelectorAll) .innerHTML 998057.1 Ops/sec
Vanilla JS (QuerySelectorAll) .textContent 1005675.6 Ops/sec
Cash .text 1537523.9 Ops/sec
Cash .html 230090.5 Ops/sec
jQuery .text() 442053.7 Ops/sec
jQuery .html() 184649.6 Ops/sec
jQuery .find() .text() 312218.9 Ops/sec
jQuery .find() .html() 156157.9 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()