-
Type: Improvement
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: Bulk API, libmongoc, Performance
_mongoc_write_command splits a stream of documents (all inserts, all updates, or all deletes) to the server 16 mb at a time. Between each 16 mb batch it destroys the command document cmd and reinitializes it. This wastes time in malloc. Just bson_reinit it after the first batch, and bson_destroy only at the end.