stream: micro-optimize high water mark calculation
Don't iterate over all 32 bits, use some hacker's delight bit twiddling to compute the next power of two. The logic can be reduced to `n = 1 << 32 - Math.clz32(n)` but then it can't easily be backported to v2.x; Math.clz32() was added in V8 4.3. PR-URL: https://github.com/nodejs/node/pull/2479 Reviewed-By:Chris Dickinson <christopher.s.dickinson@gmail.com> Reviewed-By:
Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
parent
f1f4b4c4
Please register or sign in to comment