Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.87 Safari/537.36
Chrome 78
Windows
Desktop
5 years ago
Test name Executions per second
Pure JS .innerText 1174951.9 Ops/sec
Pure JS .innerHTML 259469.9 Ops/sec
Pure JS .textContent 3505678.8 Ops/sec
jQuery .text() 503123.8 Ops/sec
jQuery .html() 133629.7 Ops/sec
jQuery .find().text() 326479.0 Ops/sec
jQuery .find().html() 110355.5 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()