-
Type: Improvement
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 1.3.0
-
Component/s: libmongoc, Performance
-
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.
- related to
-
CDRIVER-1212 C Driver Performance Benchmarking
- Closed