Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36
Chrome 61
Linux
Other
6 years ago
Test name Executions per second
Pure JS .innerText 1128393.0 Ops/sec
Pure JS .innerHTML 2262956.0 Ops/sec
Pure JS .textContent 3606014.0 Ops/sec
jQuery .text() 1210432.0 Ops/sec
jQuery .html() 1024071.0 Ops/sec
jQuery .find().text() 760019.6 Ops/sec
jQuery .find().html() 684494.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()