Run details:
Mozilla/5.0 (Linux; Android 8.0.0; SAMSUNG SM-G950F/G950FXXU1CRC7 Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/7.0 Chrome/59.0.3071.125 Mobile Safari/537.36
Chrome Mobile 59
Android 8.0.0
Samsung SM-G950F
6 years ago
Test name Executions per second
Pure JS .innerText 198525.1 Ops/sec
Pure JS .innerHTML 34053.5 Ops/sec
Pure JS .textContent 475233.9 Ops/sec
jQuery .text() 51886.7 Ops/sec
jQuery .html() 20571.3 Ops/sec
jQuery .find().text() 46332.6 Ops/sec
jQuery .find().html() 18183.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()