-
Type: Improvement
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: BSON, Performance
The Deserialize implementation for RawDocumentBuf currently will allocate separate buffers for each subdocument and subarray recursively, appending them to their parent buffers on the way up as the stack frames pop off. This can hurt performance when dealing with lots of arrays and subdocuments. Instead, we should leverage the DeserializeSeed functionality in serde to reuse the top-level buffer for all subdocuments and subarrays, which should improve performance.
Note: this only applies when deserializing RawDocumentBuf from human readable, non BSON formats.