Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:106.0) Gecko/20100101 Firefox/106.0
Firefox 106
Windows
Desktop
one year ago
Test name Executions per second
Vanilla JS .innerText 2403249.0 Ops/sec
Vanilla JS .innerHTML 6052508.5 Ops/sec
Vanilla JS .textContent 6097351.0 Ops/sec
Vanilla JS (querySelector) .innerText 1848596.9 Ops/sec
Vanilla JS (querySelector) .innerHTML 3653835.0 Ops/sec
Vanilla JS (querySelector) .textContent 3671760.5 Ops/sec
Vanilla JS (querySelectorAll) .innerText 1146966.2 Ops/sec
Vanilla JS (querySelectorAll) .innerHTML 1295210.1 Ops/sec
Vanilla JS (querySelectorAll) .textContent 1370492.6 Ops/sec
Cash .text 5085199.5 Ops/sec
Cash .html 3310898.8 Ops/sec
jQuery .text() 2858574.5 Ops/sec
jQuery .html() 2742344.8 Ops/sec
jQuery .find() .text() 1189870.5 Ops/sec
jQuery .find() .html() 1190930.8 Ops/sec
HTML Preparation code:
Tests:
  • Vanilla JS .innerText

  • Vanilla JS .innerHTML

  • Vanilla JS .textContent

  • Vanilla JS (querySelector) .innerText

  • Vanilla JS (querySelector) .innerHTML

  • Vanilla JS (querySelector) .textContent

  • Vanilla JS (querySelectorAll) .innerText

  • Vanilla JS (querySelectorAll) .innerHTML

  • Vanilla JS (querySelectorAll) .textContent

  • Cash .text

  • Cash .html

  • jQuery .text()

  • jQuery .html()

  • jQuery .find() .text()

  • jQuery .find() .html()