Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0
Firefox 81
Windows
Desktop
4 years ago
Test name Executions per second
Pure JS .innerText 842670.8 Ops/sec
Pure JS .innerHTML 1156526.2 Ops/sec
Pure JS .textContent 1176604.4 Ops/sec
jQuery .text() 789512.4 Ops/sec
jQuery .html() 749592.0 Ops/sec
jQuery .find().text() 414062.8 Ops/sec
jQuery .find().html() 397809.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()