Did not know Underscore comes with a debounce function. I always implemented my own.
How Bad is DOM Interaction Really?
21–30 of 38 posts
Re: How Bad is DOM Interaction Really?
#22After 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?
#23Earlier quoted context omitted.
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.
The DOM is a failed institution trying to grab on the the ledge before it falls into the abyss. W3C should be disbanded and HTML5 abandoned. JavaScript and it's ilk should be boycotted by users as well. This kind of complexity should exist on the server, not in the browser. I understand that people want to run complex apps in the browser. It's a bad idea in general but where it's needed, it should be PLATFORM DEPENDE…
Re: How Bad is DOM Interaction Really?
#24Earlier quoted context omitted.
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.
The DOM is a failed institution trying to grab on the the ledge before it falls into the abyss. W3C should be disbanded and HTML5 abandoned. JavaScript and it's ilk should be boycotted by users as well. This kind of complexity should exist on the server, not in the browser. I understand that people want to run complex apps in the browser. It's a bad idea in general but where it's needed, it should be PLATFORM DEPENDE…
To your friends that agree with you from 2009, use `querySelectorAll` for a non-live NodeList, assuming he has kept up with JS actually having evolved and converging on standards.
I bet you flip your lid, too, to learn your server-side-only dystopia is running on top of JS (Node) services.
Re: How Bad is DOM Interaction Really?
#25Earlier quoted context omitted.
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.
The DOM is a failed institution trying to grab on the the ledge before it falls into the abyss. W3C should be disbanded and HTML5 abandoned. JavaScript and it's ilk should be boycotted by users as well. This kind of complexity should exist on the server, not in the browser. I understand that people want to run complex apps in the browser. It's a bad idea in general but where it's needed, it should be PLATFORM DEPENDE…
Sans the VMM part, which I only thought of a few years ago, I told people all of this (that once you commit to programming on the web you need a REAL programming platform) years ago, and was dismissed. Now that it's been half-done with asm.js, webgl, websockets etc being jammed in alongside all the dumb terminal concepts as well as all the horrible previous attempts to mix programming in (e.g. Javascript and the DOM), we're unlikely to get all the way there, because it will be "good enough".
Re: How Bad is DOM Interaction Really?
#26Earlier quoted context omitted.
The DOM is a failed institution trying to grab on the the ledge before it falls into the abyss. W3C should be disbanded and HTML5 abandoned. JavaScript and it's ilk should be boycotted by users as well. This kind of complexity should exist on the server, not in the browser. I understand that people want to run complex apps in the browser. It's a bad idea in general but where it's needed, it should be PLATFORM DEPENDE…
WTF is this? I don't even know where to begin with this crackpot of a post. You suggested nothing of value and just spout a bunch of FUD. To your friends that agree with you from 2009, use `querySelectorAll` for a non-live NodeList, assuming he has kept up with JS actually having evolved and converging on standards. I bet you flip your lid, too, to learn your server-side-only dystopia is running on top of JS (Node) s…
You have nowhere to begin because I'm absolutely right. The DOM is klausterfokken.
Re: How Bad is DOM Interaction Really?
#27Earlier quoted context omitted.
The DOM is a failed institution trying to grab on the the ledge before it falls into the abyss. W3C should be disbanded and HTML5 abandoned. JavaScript and it's ilk should be boycotted by users as well. This kind of complexity should exist on the server, not in the browser. I understand that people want to run complex apps in the browser. It's a bad idea in general but where it's needed, it should be PLATFORM DEPENDE…
WTF is this? I don't even know where to begin with this crackpot of a post. You suggested nothing of value and just spout a bunch of FUD. To your friends that agree with you from 2009, use `querySelectorAll` for a non-live NodeList, assuming he has kept up with JS actually having evolved and converging on standards. I bet you flip your lid, too, to learn your server-side-only dystopia is running on top of JS (Node) s…
Re: How Bad is DOM Interaction Really?
#28No discussion of repaint and reflow? You can't leave a discussion of those out when talking about the cost of DOM manipulation. You absolutely can touch the DOM, but should do so through and interface that manages or eliminates repaint and reflow.
I have same feeling, Making single frame of JS code to run fast is cool and dandy, but eventually browser will have to make freeze and do reflow+repaint. Eventually it will make profiling harder, think about caching .offsetHeight etc. properties. It does decrease script execution time, but it does not make your app to work faster.
if you do something like
$('a').each(function(k,e){
$(e).append('' ...);
var width = $(e).width()
// do something with the width;
}
If you have code like the above, it is going to cause a repaint on each iteration. If you unroll it into three separate loops, one that does dom modification, one that does dom measurement, and another that does modification, then you will drop the number of repaints from potentially 100s to just 2.Re: How Bad is DOM Interaction Really?
#29Earlier quoted context omitted.
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.
The DOM is a failed institution trying to grab on the the ledge before it falls into the abyss. W3C should be disbanded and HTML5 abandoned. JavaScript and it's ilk should be boycotted by users as well. This kind of complexity should exist on the server, not in the browser. I understand that people want to run complex apps in the browser. It's a bad idea in general but where it's needed, it should be PLATFORM DEPENDE…
Re: How Bad is DOM Interaction Really?
#30The real hits to performance do not come from "I did X writes" or "I did Y reads", but rather from situations such as "I did X writes interleaved with Y reads, which caused Z reflows". Or "I needed to update a tiny part of the screen but triggered a full-page repaint". Or "I'm doing complex animation X, but am not triggering hardware acceleration." Reflows are very expensive. So are repaints. Chrome dev tools will al…