Run details:
Mozilla/5.0 (iPhone; CPU iPhone OS 12_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/70.0.3538.75 Mobile/15E148 Safari/605.1
Chrome Mobile iOS 70
iOS 12.1
Mobile
5 years ago
Test name Executions per second
Pure JS .innerText 257575.0 Ops/sec
Pure JS .innerHTML 88002.4 Ops/sec
Pure JS .textContent 297807.3 Ops/sec
jQuery .text() 84444.1 Ops/sec
jQuery .html() 47256.9 Ops/sec
jQuery .find().text() 54882.5 Ops/sec
jQuery .find().html() 35287.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()