Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.88 Safari/537.36
Chrome 100
Windows
Desktop
2 years ago
Test name Executions per second
Pure JS .innerText 226975.4 Ops/sec
Pure JS .innerHTML 142631.0 Ops/sec
Pure JS .textContent 1566616.4 Ops/sec
jQuery .text() 125188.5 Ops/sec
jQuery .html() 89689.6 Ops/sec
jQuery .find().text() 85894.9 Ops/sec
jQuery .find().html() 64480.3 Ops/sec
HTML Preparation code:
Tests:
  • Pure JS .innerText

  • Pure JS .innerHTML

  • Pure JS .textContent

  • jQuery .text()

  • jQuery .html()

  • jQuery .find().text()

  • jQuery .find().html()