Skip to content

bench/citm_catalog: presize the areas slice#8

Merged
JohanLindvall merged 1 commit into
presizefrom
presize-citm
Jun 24, 2026
Merged

bench/citm_catalog: presize the areas slice#8
JohanLindvall merged 1 commit into
presizefrom
presize-citm

Conversation

@JohanLindvall

Copy link
Copy Markdown
Owner

Depends on #7 (the presize feature) — base is presize, so this PR is just the one-line fixture change. Merge #7 first (or merge this into presize).

What

Tags citm_catalog's seatCategories[].areas field 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, so decodeAreas grew by append-doubling — ~19% of the citm decode in growslice. Presizing to the counted length replaces those reallocations with a single make.

metric vs base
allocs/op −54% (5882 → 2693)
B/op −46% (937 KiB → 507 KiB)
time +5.6…7.6%

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

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>
@JohanLindvall JohanLindvall merged commit 1230a47 into presize Jun 24, 2026
3 checks passed
@JohanLindvall JohanLindvall deleted the presize-citm branch June 24, 2026 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant