Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Safari/605.1.15
Safari 13
Mac OS X 10.15.5
Desktop
4 years ago
Test name Executions per second
Vanilla JS .innerText 2588824.8 Ops/sec
Vanilla JS .innerHTML 723468.2 Ops/sec
Vanilla JS .textContent 2882700.0 Ops/sec
Vanilla JS (QuerySelector) .innerText 2244638.8 Ops/sec
Vanilla JS (QuerySelector) .innerHTML 782823.0 Ops/sec
Vanilla JS (QuerySelector) .textContent 2366490.2 Ops/sec
Vanilla JS (QuerySelectorAll) .innerText 2256557.5 Ops/sec
Vanilla JS (QuerySelectorAll) .innerHTML 2059086.0 Ops/sec
Vanilla JS (QuerySelectorAll) .textContent 2232658.8 Ops/sec
Cash .text 1522660.4 Ops/sec
Cash .html 600537.6 Ops/sec
jQuery .text() 795048.6 Ops/sec
jQuery .html() 497413.9 Ops/sec
jQuery .find() .text() 531115.2 Ops/sec
jQuery .find() .html() 384171.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()


;