Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-460

Attempt to grow connection readBuf before allocating new buffer.

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 0.0.14
    • Affects Version/s: 0.0.6
    • Component/s: Connections

      Currently when we attempt to read a wire message from a connection.Connection the c.readBuf will either be the correct size already or it will be shrunk. If either of these cannot be done, then a new buffer is allocated. This wastes allocation because the buffer that was allocated could have a capacity that is of the correct size, meaning that we only actually need to allocate a buffer if the message we are going to read is larger than the largest message we've ever read.

       

      Update the ReadWireMessage method of the connection.Connection type to check the capacity of the readBuf and if the capacity is large enough, reslice the slice to that size.

            Assignee:
            matthew.chiaravalloti@mongodb.com Matthew Chiaravalloti
            Reporter:
            kris.brandow@mongodb.com Kristofer Brandow (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: