Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit/604.3.5 (KHTML, like Gecko) Version/11.0.1 Safari/604.3.5
Safari 11
Mac OS X 10.13.1
Other
6 years ago
Test name Executions per second
Pure JS .innerText 1793206.0 Ops/sec
Pure JS .innerHTML 670058.9 Ops/sec
Pure JS .textContent 1868694.0 Ops/sec
jQuery .text() 657386.7 Ops/sec
jQuery .html() 402230.4 Ops/sec
jQuery .find().text() 492070.6 Ops/sec
jQuery .find().html() 299847.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()