Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
60451: colserde: do not cap byte slice for the last buffer when deserializing r=yuzefovich a=yuzefovich We recently merged a change in which we cap each of the slices for buffers which was needed to have better memory estimate. However, now we might be under-estimating the footprint if the whole `bodyBytes` has a lot of unused capacity. Consider the following example when we have 3 buffers in the serialized representation: len(bodyBytes) == 10, cap(bodyBytes) == 20 len(buffer1) == 0, len(buffer2) == 1, len(buffer3) == 9. Before the original fix, our estimate would be 20 (the capacity of the second buffer) + 19 (the capacity of the third buffer) == 39 - huge over-estimate. With the original fix but without this commit: 1 + 9 == 10 - huge under-estimate. With this commit: 1 + 19 == 20 - exactly what we want. Release note: None Co-authored-by: Yahor Yuzefovich <[email protected]>
- Loading branch information