Run details:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:79.0) Gecko/20100101 Firefox/79.0
Firefox 79
Ubuntu
Desktop
4 years ago
Test name Executions per second
Vanilla JS .innerText 583753.7 Ops/sec
Vanilla JS .innerHTML 791325.6 Ops/sec
Vanilla JS .textContent 813957.1 Ops/sec
Vanilla JS (QuerySelector) .innerText 523410.2 Ops/sec
Vanilla JS (QuerySelector) .innerHTML 633625.2 Ops/sec
Vanilla JS (QuerySelector) .textContent 560302.2 Ops/sec
Vanilla JS (QuerySelectorAll) .innerText 287888.0 Ops/sec
Vanilla JS (QuerySelectorAll) .innerHTML 238529.3 Ops/sec
Vanilla JS (QuerySelectorAll) .textContent 256470.3 Ops/sec
Cash .text 890275.6 Ops/sec
Cash .html 920560.6 Ops/sec
jQuery .text() 590265.1 Ops/sec
jQuery .html() 523486.5 Ops/sec
jQuery .find() .text() 277147.9 Ops/sec
jQuery .find() .html() 267416.3 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()