Run details:
Mozilla/5.0 (iPhone; CPU iPhone OS 12_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.1 Mobile/15E148 Safari/604.1
Mobile Safari 12
iOS 12.3.1
Mobile
4 years ago
Test name Executions per second
Pure JS .innerText 2806461.0 Ops/sec
Pure JS .innerHTML 965106.3 Ops/sec
Pure JS .textContent 2181523.0 Ops/sec
jQuery .text() 1011813.0 Ops/sec
jQuery .html() 595906.6 Ops/sec
jQuery .find().text() 615413.0 Ops/sec
jQuery .find().html() 428952.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()