Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123.0.0.0
Chrome 123
Windows
Desktop
8 months ago
Test name Executions per second
Pure JS .innerText 1874591.4 Ops/sec
Pure JS .innerHTML 1155152.9 Ops/sec
Pure JS .textContent 4018680.0 Ops/sec
jQuery .text() 794512.2 Ops/sec
jQuery .html() 568170.6 Ops/sec
jQuery .find().text() 578876.8 Ops/sec
jQuery .find().html() 448309.6 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()