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

http: optimize by corking outgoing requests #7946

Closed
wants to merge 2 commits into from

Commits on Dec 14, 2016

  1. http: batch writes together more efficiently

    This commit opts for a simpler way to batch writes to HTTP clients into
    fewer packets. Instead of the complicated snafu which was before, now
    OutgoingMessage#write automatically corks the socket and uncorks on the
    next tick, allowing streams to batch them efficiently. It also makes the
    code cleaner and removes an ugly-ish hack.
    brendanashworth committed Dec 14, 2016
    Configuration menu
    Copy the full SHA
    cb96305 View commit details
    Browse the repository at this point in the history
  2. http: code cleanup & dry

    The first change in `_writeRaw`:
    This reduces drops an unnecessary if check (`outputLength`),
    because it is redone in `_flushOutput`. It also changes an if/else
    statement to an if statement, because the blocks were unrelated.
    
    The second change in `write`:
    This consolidates code in #write() that handled different
    string encodings and Buffers. There was no reason to handle the
    encodings differently, so after splitting them based on Buffer vs
    encoding, the code is consolidated. This might see a speedup. Shoutout
    to Ron Korving <ron@ronkorving.nl> for spotting this.
    brendanashworth committed Dec 14, 2016
    Configuration menu
    Copy the full SHA
    6acff8f View commit details
    Browse the repository at this point in the history