Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36 Edg/102.0.1245.33
Chrome 102
Windows
Desktop
2 years ago
Test name Executions per second
Pure JS .innerText 909229.9 Ops/sec
Pure JS .innerHTML 115648.1 Ops/sec
Pure JS .textContent 627606.1 Ops/sec
jQuery .text() 45574.7 Ops/sec
jQuery .html() 47354.1 Ops/sec
jQuery .find() 69356.0 Ops/sec
jQuery .find().html() 74412.2 Ops/sec
HTML Preparation code:
Tests:
  • Pure JS .innerText

  • Pure JS .innerHTML

  • Pure JS .textContent

  • jQuery .text()

  • jQuery .html()

  • jQuery .find()

  • jQuery .find().html()