Details
-
Improvement
-
Resolution: Fixed
-
Major
-
3.4.15
Description
Multi-lookup and multi-get operations are current allocating a new byte array on the heap for the body of every spec and copying the memory into that spec. This is creating unnecessary heap allocations and memory copies.
The impact is minor for small spec bodies, but is very significant for large bodies. For example, if a LookupIn with a GetFull is performed, perhaps to get with XATTRs, then the entire body of the document is allocated into an array on the heap. If the document is a large one (> 85KB) this is a Gen2 allocation on the Large Object Heap.
Instead, each spec could be managed as a ReadOnlyMemory<byte> view onto a slice of the overall operation response. This eliminates the heap allocation and the memory copy.
Note: This is already the case for "automatic" LookupIn, such as projections or gets with expiry. It just isn't handled for explicit LookupIn and MutateIn operations.