benchmark: use a bitwise right shift for faster division#2658
benchmark: use a bitwise right shift for faster division#2658JungMinu wants to merge 1 commit intonodejs:masterfrom JungMinu:patch-10
Conversation
Division in Javascript is known to be very slow use a Bitwise right shift for faster division for better performance
|
Please refer to the following article for the performance review |
|
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. |
|
@mscdex Thanks, then do you think that this PR should be closed? |
|
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. |
|
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. |
|
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