Optimize TcParser::RepeatedVarint #23980
Draft
+25
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Optimize TcParser::RepeatedVarint
We spend more time on reallocating than parsing, so
count and preallocate space once. Saves some cpu and
a lot or RAM.
name cpu/op cpu/op vs base
BM_Parse_MemberParseFromString 748.7n ± 3% 682.3n ± 1% -8.87% (p=0.002 n=6)
BM_Parse_RiegeliParseFromString 749.0n ± 3% 680.5n ± 1% -9.15% (p=0.002 n=6)
BM_Parse_RiegeliParseFromChain 758.7n ± 3% 691.8n ± 8% -8.82% (p=0.002 n=6)
BM_Parse_MemberParseFromCord 767.2n ± 4% 701.6n ± 4% -8.55% (p=0.002 n=6)
BM_Parse_RiegeliParseFromCord 765.9n ± 3% 704.0n ± 2% -8.08% (p=0.002 n=6)
name peak-mem(Bytes)/op peak-mem(Bytes)/op vs base
BM_Parse_MemberParseFromString 3.072k ± 0% 1.792k ± 0% -41.67% (p=0.002 n=6)
BM_Parse_RiegeliParseFromString 3.072k ± 0% 1.792k ± 0% -41.67% (p=0.002 n=6)
BM_Parse_RiegeliParseFromChain 3.072k ± 0% 1.792k ± 0% -41.67% (p=0.002 n=6)
BM_Parse_MemberParseFromCord 3.072k ± 0% 1.792k ± 0% -41.67% (p=0.002 n=6)
BM_Parse_RiegeliParseFromCord 3.072k ± 0% 1.792k ± 0% -41.67% (p=0.002 n=6