Run details:
Mozilla/5.0 (iPhone; CPU iPhone OS 12_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/71.0.3578.89 Mobile/15E148 Safari/605.1
Chrome Mobile iOS 71
iOS 12.1
Mobile
5 years ago
Test name Executions per second
Pure JS .innerText 1123756.0 Ops/sec
Pure JS .innerHTML 278115.3 Ops/sec
Pure JS .textContent 1295152.0 Ops/sec
jQuery .text() 211998.3 Ops/sec
jQuery .html() 106628.7 Ops/sec
jQuery .find().text() 135276.6 Ops/sec
jQuery .find().html() 79412.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()