bench/citm_catalog: presize the areas slice#8
Merged
Conversation
Tag the seatCategories[].areas field with ,presize. Its element is a struct of a scalar (areaId) plus a 1-D leaf collection (blockIds []any, always empty in the corpus), so presizing it to the counted length replaces the append-doubling reallocations (decodeAreas was ~19% of the decode in growslice) with a single make: allocs -54%, B/op -46%, at +5.6..7.6% decode time. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Depends on #7 (the
presizefeature) — base ispresize, so this PR is just the one-line fixture change. Merge #7 first (or merge this intopresize).What
Tags citm_catalog's
seatCategories[].areasfield with,presize.Why
areas's element is a struct of a scalar (areaId) plus a 1-D leaf collection (blockIds []any, always empty in the corpus). That made it ineligible for the default presize, sodecodeAreasgrew by append-doubling — ~19% of the citm decode ingrowslice. Presizing to the counted length replaces those reallocations with a singlemake.A space-for-time trade, exposed deliberately via the opt-in tag rather than forced — see #7 for the full rationale.
🤖 Generated with Claude Code