Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.2 Safari/605.1.15
Safari 14
Mac OS X 10.15.6
Desktop
3 years ago
Test name Executions per second
Pure JS .innerText 2371150.5 Ops/sec
Pure JS .innerHTML 773579.9 Ops/sec
Pure JS .textContent 2473729.0 Ops/sec
jQuery .text() 700147.9 Ops/sec
jQuery .html() 399122.6 Ops/sec
jQuery .find().text() 518815.6 Ops/sec
jQuery .find().html() 310133.3 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()