I profiled various native methods, comparing them to equivalent polyfills 
and special-cased ones. I compared the following functions:

   - Math.abs(x)
   - Array.prototype.pop()
   - Math.ceil(x)
   - Array.prototype.join(sep)

I found the following things from testing in various browsers:

   - Math.abs(x)
      - Webkit is about twice as fast as V8 in the native implementation.
      - Webkit's performance in the rest is on par with V8's.
      - Similar performance between type-ignorant polyfills and native 
      implementation (on all browsers)
   - Array.prototype.pop()
      - Firefox clearly hasn't optimized the special case for arrays 
      natively.
      - JS polyfills are insanely slow, with type checking making little 
      difference.
   - Math.ceil(x)
      - JS polyfills significantly slower, but that is explainable with the 
      better bitwise ability with floats/doubles/etc. in C/C++.
         - Mine does it without branching, but a potentially better way is 
         to decrement if less than 0 and truncate it.
      - Webkit is a little faster, but not a lot.
   - Array.prototype.join(sep)
      - JS standards polyfill rather slow
      - JS polyfill assuming an array is over twice as fast as the native 
      implementation (If it optimizes for this case, it should structurally 
      resemble a Java Object[] internally).
         - This really needs a special case (or better special case) for 
         Arrays.
      
I can't a patch for this yet, because of current CLA confusion (off-topic), 
but it should be relatively simple.

-- 
-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to