Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
Chrome 68
Windows
Desktop
6 years ago
Test name Executions per second
Pure JS .innerText 1311019.1 Ops/sec
Pure JS .innerHTML 153235.9 Ops/sec
Pure JS .textContent 2027732.6 Ops/sec
jQuery .text() 232610.0 Ops/sec
jQuery .html() 96078.8 Ops/sec
jQuery .find() 200108.1 Ops/sec
jQuery .find().html() 83933.9 Ops/sec
HTML Preparation code:
Tests:
  • Pure JS .innerText

  • Pure JS .innerHTML

  • Pure JS .textContent

  • jQuery .text()

  • jQuery .html()

  • jQuery .find()

  • jQuery .find().html()