Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36
Chrome 103
Mac OS X 10.15.7
Desktop
2 years ago
Test name Executions per second
Pure JS .innerText 1473502.0 Ops/sec
Pure JS .innerHTML 566365.2 Ops/sec
Pure JS .textContent 3289007.5 Ops/sec
jQuery .text() 775210.1 Ops/sec
jQuery .html() 379557.1 Ops/sec
jQuery .find() 577246.6 Ops/sec
jQuery .find().html() 320859.4 Ops/sec
HTML Preparation code:
Tests:
  • Pure JS .innerText

  • Pure JS .innerHTML

  • Pure JS .textContent

  • jQuery .text()

  • jQuery .html()

  • jQuery .find()

  • jQuery .find().html()