Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36
Chrome 93
Mac OS X 10.14.6
Desktop
3 years ago
Test name Executions per second
Pure JS .innerText 1081796.4 Ops/sec
Pure JS .innerHTML 269151.8 Ops/sec
Pure JS .textContent 3225163.2 Ops/sec
jQuery .text() 551969.9 Ops/sec
jQuery .html() 197946.7 Ops/sec
jQuery .find().text() 400961.9 Ops/sec
jQuery .find().html() 163020.8 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()