Thanks so much for your detailed explanation Jakob!  You've given me deep 
insights to v8.

On Sunday, April 7, 2013 3:02:06 PM UTC-6, Jakob Kummerow wrote:
>
> This is expected. V8 has a special optimization for "Math.floor of a 
> division".... 
>
Essentially, in the "floor of div" case V8 decides that it can treat the 
> numbers as integers, and further that division by constant 2 can be done by 
> bit shift, so in optimized code it actually emits a bit shift instruction. 
> In the "*.5" case, on the other hand, a regular floating-point 
> multiplication is performed, and the resulting floating-point number is 
> then rounded (well, floored) to integer, which is a bit slower. 
>

-- 
-- 
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/groups/opt_out.


Reply via email to