The results from this test does not seem right:
http://jsperf.com/math-floor-divide-2-vs-bit-shift/3
The tests are basically: i >> 1, Math.floor(i/2), & Math.floor(i*.5)

Results in Ops/sec 
UserAgent: Bit shift | .floor /2 | .floor *.5 || # Tests
Chrome 24: 4,688,830 | 4,683,492 | 2,435,539  || 4
PM/FF19:   5,392,935 | 2,165,562 | 2,500,029  || 2

The Firefox results are what I expect; bit shifting is wicked-fast (since 
it is a fast, simple opcode).  Math.floor(i/2) in Firefox is a bit faster 
than what I expected, but still much slower than >>.  Multiply is naturally 
faster than the divide opcode.

In this test Chrome is fast with the bit shift, almost as fast with 
Math.floor(i/2), BUT much slower than Math.floor(i*.5).  Something seems 
wrong here.

I can see that Chrome/v8 has a super-fast Math.floor()
http://rocha.la/JavaScript-bitwise-operators-in-practice
However, it should be fast with the second .floor also, since *.5 is a 
faster form of /2.

Thoughts please?
& is this best posted here or on Chromium?

-- 
-- 
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