Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

stream: switch _writableState.buffer to queue #8826

Commits on Dec 4, 2014

  1. stream: switch _writableState.buffer to queue

    In cases where many small writes are made to a stream
    lacking _writev, the array data structure backing the
    WriteReq buffer would greatly increase GC pressure.
    
    Specifically, in the fs.WriteStream case, the
    clearBuffer routine would only clear a single WriteReq
    from the buffer before exiting, but would cause the
    entire backing array to be GC'd. Switching to [].shift
    lessened pressure, but still the bulk of the time was
    spent in memcpy.
    
    This replaces that structure with a linked list-backed
    queue so that adding and removing from the queue is O(1).
    In the _writev case, collecting the buffer requires an
    O(N) loop over the buffer, but that was already being
    performed to collect callbacks, so slowdown should be
    neglible.
    chrisdickinson committed Dec 4, 2014
    Configuration menu
    Copy the full SHA
    04d9a1b View commit details
    Browse the repository at this point in the history

Commits on Dec 5, 2014

  1. Configuration menu
    Copy the full SHA
    d8a2be5 View commit details
    Browse the repository at this point in the history