Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The one I wish they had measured was createElement compared to innerHTML replacement.

In my job I was always shocked to see massive HTML strings appended or replaced in an objects innerHTML, and instead wrote lots of createElements and createTextNodes. Apparently, for performance's sake (and especially in loops) it is MUCH more efficient to use a string and replace methods to alter the content.



See also: createDocumentFragment()

http://ejohn.org/blog/dom-documentfragments/




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: