Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36
Chrome 105
Mac OS X 10.15.7
Desktop
2 years ago
Test name Executions per second
Pure JS .innerText 2719334.5 Ops/sec
Pure JS .innerHTML 776693.9 Ops/sec
Pure JS .textContent 5904729.5 Ops/sec
jQuery .text() 1375910.1 Ops/sec
jQuery .html() 551552.9 Ops/sec
jQuery .find() 1058443.6 Ops/sec
jQuery .find().html() 474142.8 Ops/sec
HTML Preparation code:
Tests:
  • Pure JS .innerText

  • Pure JS .innerHTML

  • Pure JS .textContent

  • jQuery .text()

  • jQuery .html()

  • jQuery .find()

  • jQuery .find().html()