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 2912059.2 Ops/sec
Vanilla JS .innerHTML 915894.4 Ops/sec
Vanilla JS .textContent 3014466.0 Ops/sec
Vanilla JS (QuerySelector) .innerText 2238743.8 Ops/sec
Vanilla JS (QuerySelector) .innerHTML 801685.1 Ops/sec
Vanilla JS (QuerySelector) .textContent 2337191.2 Ops/sec
Vanilla JS (QuerySelectorAll) .innerText 2322682.8 Ops/sec
Vanilla JS (QuerySelectorAll) .innerHTML 2309289.2 Ops/sec
Vanilla JS (QuerySelectorAll) .textContent 2298563.5 Ops/sec
Cash .text 1691275.9 Ops/sec
Cash .html 630266.9 Ops/sec
jQuery .text() 895938.6 Ops/sec
jQuery .html() 510429.0 Ops/sec
jQuery .find() .text() 581944.4 Ops/sec
jQuery .find() .html() 404640.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()


;