Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0
Firefox 58
Linux
Other
2025 years ago
Test name Executions per second
Pure JS .innerText 716770.8 Ops/sec
Pure JS .innerHTML 1365181.9 Ops/sec
Pure JS .textContent 1612221.1 Ops/sec
jQuery .text() 849184.8 Ops/sec
jQuery .html() 930752.0 Ops/sec
jQuery .find().text() 234478.0 Ops/sec
jQuery .find().html() 222324.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()