Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.80 Safari/537.36 Edg/98.0.1108.43
Chrome 98
Windows
Desktop
2 years ago
Test name Executions per second
Pure JS .innerText 1313353.6 Ops/sec
Pure JS .innerHTML 387413.4 Ops/sec
Pure JS .textContent 3416659.8 Ops/sec
jQuery .text() 660166.6 Ops/sec
jQuery .html() 284674.9 Ops/sec
jQuery .find().text() 467825.4 Ops/sec
jQuery .find().html() 231329.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()