Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36 Edg/101.0.1210.39
Chrome 101
Windows
Desktop
2 years ago
Test name Executions per second
Pure JS .innerText 192668.6 Ops/sec
Pure JS .innerHTML 105006.2 Ops/sec
Pure JS .textContent 1361110.0 Ops/sec
jQuery .text() 116633.6 Ops/sec
jQuery .html() 76973.3 Ops/sec
jQuery .find() 92244.0 Ops/sec
jQuery .find().html() 69342.2 Ops/sec
HTML Preparation code:
Tests:
  • Pure JS .innerText

  • Pure JS .innerHTML

  • Pure JS .textContent

  • jQuery .text()

  • jQuery .html()

  • jQuery .find()

  • jQuery .find().html()