Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:96.0) Gecko/20100101 Firefox/96.0
Firefox 96
Windows
Desktop
2 years ago
Test name Executions per second
Pure JS .innerText 1041278.2 Ops/sec
Pure JS .innerHTML 1385911.8 Ops/sec
Pure JS .textContent 1420783.9 Ops/sec
jQuery .text() 773167.1 Ops/sec
jQuery .html() 775414.7 Ops/sec
jQuery .find().text() 427771.3 Ops/sec
jQuery .find().html() 425338.2 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()