Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stream: code cleanup and micro-optimization #2479

Merged
merged 3 commits into from
Aug 24, 2015

Commits on Aug 24, 2015

  1. stream: fix off-by-factor-16 error in comment

    The high watermark is capped at 8 MB, not 128 MB like the comment
    in lib/_stream_readable.js said.
    
    PR-URL: nodejs#2479
    Reviewed-By: Chris Dickinson <[email protected]>
    Reviewed-By: Sakthipriyan Vairamani <[email protected]>
    bnoordhuis committed Aug 24, 2015
    Configuration menu
    Copy the full SHA
    1a3f4a8 View commit details
    Browse the repository at this point in the history
  2. 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: nodejs#2479
    Reviewed-By: Chris Dickinson <[email protected]>
    Reviewed-By: Sakthipriyan Vairamani <[email protected]>
    bnoordhuis committed Aug 24, 2015
    Configuration menu
    Copy the full SHA
    3af8e45 View commit details
    Browse the repository at this point in the history
  3. stream: rename poorly named function

    roundUpToNextPowerOf2() does more than just rounding up to the next
    power of two.  Rename it to computeNewHighWaterMark().
    
    PR-URL: nodejs#2479
    Reviewed-By: Chris Dickinson <[email protected]>
    Reviewed-By: Sakthipriyan Vairamani <[email protected]>
    bnoordhuis committed Aug 24, 2015
    Configuration menu
    Copy the full SHA
    caa0d0c View commit details
    Browse the repository at this point in the history