Vanilla JS, Cash and jQuery - GetText Speed Test

7 months ago
User agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:106.0) Gecko/20100101 Firefox/106.0
Test name Executions per second
Vanilla JS .innerText 2403249.0 Ops/sec
Vanilla JS .innerHTML 6052509.0 Ops/sec
Vanilla JS .textContent 6097351.0 Ops/sec
Vanilla JS (querySelector) .innerText 1848597.0 Ops/sec
Vanilla JS (querySelector) .innerHTML 3653835.0 Ops/sec
Vanilla JS (querySelector) .textContent 3671761.0 Ops/sec
Vanilla JS (querySelectorAll) .innerText 1146966.0 Ops/sec
Vanilla JS (querySelectorAll) .innerHTML 1295210.0 Ops/sec
Vanilla JS (querySelectorAll) .textContent 1370493.0 Ops/sec
Cash .text 5085200.0 Ops/sec
Cash .html 3310899.0 Ops/sec
jQuery .text() 2858575.0 Ops/sec
jQuery .html() 2742345.0 Ops/sec
jQuery .find() .text() 1189871.0 Ops/sec
jQuery .find() .html() 1190931.0 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()

Open this result on MeasureThat.net