Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.75 Safari/537.36
Chrome 62
Linux
Other
7 years ago
Test name Executions per second
Pure JS .innerText 542565.4 Ops/sec
Pure JS .innerHTML 1263221.0 Ops/sec
Pure JS .textContent 2510400.5 Ops/sec
jQuery .text() 584598.2 Ops/sec
jQuery .html() 413613.8 Ops/sec
jQuery .find().text() 345929.6 Ops/sec
jQuery .find().html() 285577.4 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()