Re: Offline transcript

On Wednesday, December 19, 2012 at 5:29 PM, François REMY wrote:

> <an interesting note about using native implementations>
>  
> At some point, it was ‘hot’ to use ‘x.forEach(..)’ instead of ‘for(...)’ because ‘forEach’ is written in the browser, so in C++, so it has to be more efficient, right? Recently, FireFox team discovered that if they replaced their C++ implementation by a JavaScript one, the code was actually faster (thanks to compilation tricks like function inlining) and a patch was landed recently to do so.
>  
> The same story happened to Twitter at some point when jQuery switched from ‘javascript-based’ CSS to querySelectorAll because in some browser, the perf was less good than the javascript version in some cases.  
>  
> The fact is: if your code is fast enough using your JavaScript implementation, don’t switch to the native version (especially, don’t use it “if it exists” if you can't even test it on all browsers at the time you write your site).
>  
> Thinking the native implementation will always be faster is a synonym for being optimistic :-D
>  

Yeah, good points.   
--  
Marcos Caceres

Received on Wednesday, 19 December 2012 17:40:33 UTC