Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15
Safari 15
Mac OS X 10.15.7
Desktop
2 years ago
Test name Executions per second
Pure JS .innerText 2021152.1 Ops/sec
Pure JS .innerHTML 680350.0 Ops/sec
Pure JS .textContent 1995040.8 Ops/sec
jQuery .text() 683462.5 Ops/sec
jQuery .html() 257002.2 Ops/sec
jQuery .find() 109286.0 Ops/sec
jQuery .find().html() 63279.3 Ops/sec
HTML Preparation code:
Tests:
  • Pure JS .innerText

  • Pure JS .innerHTML

  • Pure JS .textContent

  • jQuery .text()

  • jQuery .html()

  • jQuery .find()

  • jQuery .find().html()