Performance: JavaScript adding text to a node

Published 2014-07-25

What is the most reasonable approach?

  • jQuery’s .html() with previously encoded text
  • Query’s .text()
  • innerHTML with previously encoded text
  • innerText / textContent
  • document.createTextNode once per element
  • document.createTextNode once per test run


Link on jsPerf