Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36
Chrome 81
Mac OS X 10.15.4
Desktop
4 years ago
Test name Executions per second
Vanilla JS .innerText 107226.6 Ops/sec
Vanilla JS .innerHTML 42937.6 Ops/sec
Vanilla JS .textContent 880688.0 Ops/sec
Vanilla JS (QuerySelector) .innerText 98476.0 Ops/sec
Vanilla JS (QuerySelector) .innerHTML 53384.4 Ops/sec
Vanilla JS (QuerySelector) .textContent 751146.9 Ops/sec
Vanilla JS (QuerySelectorAll) .innerText 389693.6 Ops/sec
Vanilla JS (QuerySelectorAll) .innerHTML 384275.9 Ops/sec
Vanilla JS (QuerySelectorAll) .textContent 394953.4 Ops/sec
Cash .text 615336.1 Ops/sec
Cash .html 46232.3 Ops/sec
jQuery .text() 36865.6 Ops/sec
jQuery .html() 38973.0 Ops/sec
jQuery .find() .text() 48082.9 Ops/sec
jQuery .find() .html() 35263.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()