forked from TrueCloudLab/frostfs-node
[#1262] metabase: Optimize decodeList
Prevent additional allocation during `append` in `Put`. ``` name old alloc/op new alloc/op delta Put/parallel-8 131kB ± 1% 126kB ± 4% -3.87% (p=0.005 n=8+8) Put/sequential-8 172kB ± 1% 171kB ± 1% -0.73% (p=0.028 n=10+9) ``` Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
456e1584d6
commit
d45df614fb
1 changed files with 1 additions and 1 deletions
|
@ -379,7 +379,7 @@ func decodeList(data []byte) (lst [][]byte, err error) {
|
||||||
}
|
}
|
||||||
r := io.NewBinReaderFromBuf(data)
|
r := io.NewBinReaderFromBuf(data)
|
||||||
l := r.ReadVarUint()
|
l := r.ReadVarUint()
|
||||||
lst = make([][]byte, l)
|
lst = make([][]byte, l, l+1)
|
||||||
for i := range lst {
|
for i := range lst {
|
||||||
lst[i] = r.ReadVarBytes()
|
lst[i] = r.ReadVarBytes()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue