After 10+ years as a performance leaning C++ desktop app developer I'm looking for any and all tips to make JavaScript (jQuery too) work in perceivably faster ways. I'm use to threading database calls, using message queues, and views updating themselves from caches. It’s a new world for me and feels somewhat like a step backwards. Here I come html5!
You can use queues when creating a large number of elements. Use requestAnimationFrame and each frame pop some elements off the queue to render them. This will help prevent the page from locking up during render events.
How Bad is DOM Interaction Really?
11–20 of 38 posts
Re: How Bad is DOM Interaction Really?
#12Just looking at their implementations in WebKit should tell you why:
https://github.com/WebKit/webkit/blob/master/Source/WebCore/...
https://github.com/WebKit/webkit/blob/master/Source/WebCore/...
Re: How Bad is DOM Interaction Really?
#13Re: How Bad is DOM Interaction Really?
#14Really the resize thing is sort of bs also because it is such an incredibly rare thing to handle (99% of all apps will never ever require handling resize except to test responsive designs)
Re: How Bad is DOM Interaction Really?
#15I mean no offense to the author, but speaking of the DOM as if it is uniform in terms of performance seems silly. Pretty much every piece of API in the DOM has its own semantics and performance expectations (even if it's presented as a JavaScript property). Reading Element.offsetLeft, for instance, is a whole different world from reading Node.nodeType. Just looking at their implementations in WebKit should tell you w…
The case is extremely misrepresented indeed.
Re: How Bad is DOM Interaction Really?
#16After 10+ years as a performance leaning C++ desktop app developer I'm looking for any and all tips to make JavaScript (jQuery too) work in perceivably faster ways. I'm use to threading database calls, using message queues, and views updating themselves from caches. It’s a new world for me and feels somewhat like a step backwards. Here I come html5!
Re: How Bad is DOM Interaction Really?
#17Caching jQuery selectors may result in a speedup, but as with all caching systems I've run into nasty, hard to trace bugs that were the result of stale cached jQuery selectors. So I'd add the caveat to caching jQuery selectors that standard premature optimization rules still apply.
Re: How Bad is DOM Interaction Really?
#18These timings are all remarkably random, even with 10k repetitions.
Re: How Bad is DOM Interaction Really?
#19http://learn.jquery.com/performance/
It's brief and quite informative.
Re: How Bad is DOM Interaction Really?
#20I mean no offense to the author, but speaking of the DOM as if it is uniform in terms of performance seems silly. Pretty much every piece of API in the DOM has its own semantics and performance expectations (even if it's presented as a JavaScript property). Reading Element.offsetLeft, for instance, is a whole different world from reading Node.nodeType. Just looking at their implementations in WebKit should tell you w…
Also, the code doesn't call into DOM directly but uses jQuery .html() for "reading" and .html(Math.random()) for "writing". The case is extremely misrepresented indeed.
DOM Lvl 4 even features GC! Can we not see why this is a bad idea?!? Keyboard bindings also do not belong in a "standard". I wish this would get more attention by serious developers, but I think that most people who know better wouldn't care and aren't interested in understanding and digging into a lame standard. It's a land grab, only enterprises can and will ever be able to implement it correctly and completely, as the standard spreads to consume more of the user's space.
Here are some people who agree with me:
http://www.adamcrume.com/blog/archive/2009/12/23/the-java-do...
http://programmers.stackexchange.com/questions/147451/whats-...