News for hackers. Stuff that matters.
Re:The DOM isn't slow by creativename on Tuesday March 19, 2013 @10:32AM (#5401073)
I find myself constantly trying to fight the urge to be lazy with JQuery, since I tend to forget the performance hit it entails.

For some concrete numbers, I updated a JSPerf that I found to include a raw JS implemention.

http://jsperf.com/creating-dom-elements/8

I was caught off-guard by the results - it appears that (even after multiple runs) the raw JS implementation is ~100 times (times, not %) faster. Definitely surprised at the drastic difference, although someone please correct me if I missed something in these simple test cases.

This was with Chrome on Windows, by the way.

Re:The DOM isn't slow by krrrh on Tuesday March 19, 2013 @11:36AM (#5401486)
Version 10 of your test is really surprising. The raw JS append function just came out 250 times faster than the jquery direct append example, and 750 times faster than jquery append variable. This is on chrome for iOS.
Re:The DOM isn't slow by creativename on Tuesday March 19, 2013 @12:59PM (#5402075)
Wow, yeah. Document fragments seem to be even faster than my original createElement. I'm really going to have to re-evaluate how I'm creating new DOM elements.
Re:The DOM isn't slow by korynunn on Tuesday March 19, 2013 @08:27PM (#5404700)
This is the kind of thing I was hoping to inspire. Sure, use jQuery, but use it wisely. That said, literally never make DOM in it, for so many reasons...
Re:The DOM isn't slow by RyanMcGreal on Tuesday March 19, 2013 @10:40AM (#5401136)
I got different results on Windows XP (don't ask). Using both Firefox 19 and Chrome 25, Direct append came in the fastest with modestly slower performance (around 5-10%) from the other methods.
Re:The DOM isn't slow by creativename on Tuesday March 19, 2013 @11:00AM (#5401253)
That sounds way more realistic - I'm not sure what's going on when I'm testing, but I may try later to repeat.