Hacker News new | ask | show | jobs
by taitems 6060 days ago
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.

1 comments

See also: createDocumentFragment()

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