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 2867244.2 Ops/sec
Vanilla JS .innerHTML 846785.1 Ops/sec
Vanilla JS .textContent 3006447.2 Ops/sec
Vanilla JS (QuerySelector) .innerText 2237143.2 Ops/sec
Vanilla JS (QuerySelector) .innerHTML 733678.2 Ops/sec
Vanilla JS (QuerySelector) .textContent 2294035.8 Ops/sec
Vanilla JS (QuerySelectorAll) .innerText 2237061.0 Ops/sec
Vanilla JS (QuerySelectorAll) .innerHTML 2237508.0 Ops/sec
Vanilla JS (QuerySelectorAll) .textContent 2239989.8 Ops/sec
Cash .text 1655301.0 Ops/sec
Cash .html 594058.7 Ops/sec
jQuery .text() 839153.7 Ops/sec
jQuery .html() 514494.9 Ops/sec
jQuery .find() .text() 608749.2 Ops/sec
jQuery .find() .html() 380578.2 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()


;