Run details:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:65.0) Gecko/20100101 Firefox/65.0
Firefox 65
Ubuntu
Desktop
5 years ago
Test name Executions per second
Pure JS .innerText 375634.9 Ops/sec
Pure JS .innerHTML 507869.3 Ops/sec
Pure JS .textContent 526764.9 Ops/sec
jQuery .text() 349785.9 Ops/sec
jQuery .html() 319641.2 Ops/sec
jQuery .find().text() 164002.1 Ops/sec
jQuery .find().html() 150376.5 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()