-
Type: Improvement
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: 1.5.2
-
Component/s: None
-
None
This loop in Operation.createMsgWireMessage() is inefficient:
for _, doc := range op.Batches.Current {
dst = append(dst, doc...)
}
since dst is not at the required cap before the loop, it causes multiple allocations and the final cap of dst can be up to 2x larger than needed.
Calculating the total length of batches in op.Batches.Current and resizing dst before the loop would be more efficient.
- related to
-
GODRIVER-1670 Use buffer pooling and copying return values to reduce memory allocation
- Closed