Uh oh!
There was an error while loading. Please reload this page.
benchmark: use a bitwise right shift for faster division - #2658
Conversation
Division in Javascript is known to be very slow use a Bitwise right shift for faster division for better performance
JungMinu
commented
Sep 2, 2015
Please refer to the following article for the performance review |
mscdex
commented
Sep 2, 2015
This particular change is outside of the actual timing, so it's not going to affect the actual results. Besides, making the benchmarks themselves faster is less beneficial than making the code that the benchmarks are testing, faster. |
JungMinu
commented
Sep 2, 2015
@mscdex Thanks, then do you think that this PR should be closed? |
mscdex
commented
Sep 2, 2015
Also FWIW the article you linked to was written with Chrome 35 in mind which is quite old. This jsperf shows that Chrome 45 for example optimizes all of the various methods given in the article so they all perform the same. |
ChALkeR
commented
Sep 2, 2015
The only change here is replacing I really doubt that this would make any measurable difference here, when comparing a single division of a number by 2 with allocating a new Array of 51201 elements and then joining it's elements using Also, as @mscdex mentioned, that's outside of the timing, it's just preparation code. |
Trott
commented
Sep 4, 2015
Closing this one based on discussion above. Feel free to re-open if you think that's premature. |
Division in Javascript is known to be very slow
use a Bitwise right shift for faster division for better performance