Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-1215

Eliminate copy of command reply document

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.4.0
    • Affects Version/s: 1.3.0
    • Component/s: libmongoc, Performance
    • Labels:
      None

      mongoc_client_command_simple takes a pointer to a bson_t, into which it must copy the command reply. In the past, users who wanted to avoid the copy could use mongoc_client_command instead. (It returns a cursor which holds the original RPC, avoiding the copy.)

      But the new find / getMore commands required me to separate commands from cursors (CDRIVER-906) and send all "find" commands through the cursor-less command path, which copies the reply. (See _mongoc_cursor_find_command.)

      Eliminate the copy:

      1. Add uint8_t *bson_reserve_buffer(bson_t, size_t).
      2. Use bson_reserve_buffer to preallocate the reply's internal buffer as soon as we know the reply's size.
      3. Receive the server response directly into the reply buffer.

            Assignee:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: