Extreme JavaScript Performance
slideshare.net
Extreme JavaScript Performance
1–10 of 18 posts
Re: Extreme JavaScript Performance
#2Re: Extreme JavaScript Performance
#3I don't think I'd inflict ~~(1*"12.5") on someone for an insignificant gain when a parseInt() is obvious. (I also suspect that at least one of those implementations constant folded it.)
Re: Extreme JavaScript Performance
#4http://mir.aculo.us/ http://script.aculo.us/downloads/extremejs.pdf
Slideshare is terribly unresponsive at times, and the registration's capcha doesn't work properly.
Re: Extreme JavaScript Performance
#5For example, what is the performance penalty of:
var arr = [1, 2, 3];
for(var i=0; i
Or @ caching: $("a").each( function(){
$(this).click(
$(this).find("img").hide();
);
});
// versus
$("a").each( function(){
var targetImage = $(this).find("img");
$(this).click(
$(targetImage).hide();
);
});Re: Extreme JavaScript Performance
#6Author's page with PDF of slides http://mir.aculo.us/ http://script.aculo.us/downloads/extremejs.pdf Slideshare is terribly unresponsive at times, and the registration's capcha doesn't work properly.
Re: Extreme JavaScript Performance
#7How come JIT compilers seem to have a problem with compiling try/catch blocks? Also, why does caching the window object increase performance by significant margins in some of the browsers?
"with", try/catch, etc. all introduce another level of scope, which means anything you reference that isn't in that scope directly takes more time to look up. Yeah, it's pretty retarded.
Re: Extreme JavaScript Performance
#8Author's page with PDF of slides http://mir.aculo.us/ http://script.aculo.us/downloads/extremejs.pdf Slideshare is terribly unresponsive at times, and the registration's capcha doesn't work properly.
thanks for the alternative link and the hint regarding Slideshare. next time when I find an interesting presentation on Slideshare I'll look out for an alternative link.
Re: Extreme JavaScript Performance
#9How come JIT compilers seem to have a problem with compiling try/catch blocks? Also, why does caching the window object increase performance by significant margins in some of the browsers?
It has to do with JavaScript's "scope chain" method of looking up symbol bindings. If something isn't in the current scope, it has to incrementally check each "scope" (such a bastardization..) for the binding it's looking for. If it works its way back up to the global (window) object's "scope" and doesn't find it, it gives up and returns undefined. "with", try/catch, etc. all introduce another level of scope, which m…
I realize that things like window.x can be added at runtime, but local scopes ought to be simple to rule out.... as long as there are no calls to eval() .....
eval(), which can introduce local bindings at runtime from arbitrary, runtime-constructed strings....
Ugh.
And since aliases to eval can also be created, in any scope, from other dynamically eval()'d code strings, you can't even be sure that any nonlocal symbol won't resolve to eval.
So the only way you can be sure that a level of scope can be skipped in the lookup chain is if there are no function calls made on any redefinable nonlocal symbols.
If there were a subset of javascript where eval was a keyword instead of an identifier, then this would be easier.