Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36
Chrome 59
Mac OS X 10.12.5
Other
7 years ago
Test name Executions per second
Pure JS .innerText 794137.8 Ops/sec
Pure JS .innerHTML 1531906.2 Ops/sec
Pure JS .textContent 2277488.2 Ops/sec
jQuery .text() 965683.5 Ops/sec
jQuery .html() 855904.0 Ops/sec
jQuery .find().text() 582078.9 Ops/sec
jQuery .find().html() 538131.8 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()