TreeDB/caching: reserve pointer batch index metadata - #3528
Conversation
|
Warning Review limit reached
Next review available in: 14 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Batch.SetWithRevisionallocation as required plain-Setcaller-ownership copy plus pointer-batch metadata/slice growth, not duplicate stable-view copying.ptrValueIdxsfrom the existing batch int-slice pool when a batch first stages pointer-sized values, and returns that slice onClose.BenchmarkBatchSetWithRevisionAllocationShapegate covering inlineSetWithRevision, pointerSetWithRevision, and the existing stable-view no-copy path.Evidence
Issue heap-profile peeks saved under
/mnt/fast4tb/tmp/gomap-3526-setwithrevision-20260706T085722Z:plain-send:Batch.SetWithRevision1161.37MB flat / 1611.14MB cum of 111336.25MB total; child allocations areclonePtrValue216.18MB,cloneKeyValue208.34MB,cloneKey25.25MB.small-multisend:Batch.SetWithRevision3249.35MB flat / 3774.08MB cum of 138570.57MB total; child allocations areclonePtrValue495.11MB,cloneKeyValue17.62MB,cloneKey12.01MB.Focused benchmark artifact root:
/mnt/fast4tb/tmp/gomap-3526-setwithrevision-20260706T085722Zbenchstat bench_setwithrevision_count5.txt bench_setwithrevision_after_count5.txt:SetWithRevision_pointer_64x32x2048: 2.349KiB/op -> 1.286KiB/op (-45.24%); 20 allocs/op -> 13 allocs/op (-35.00%); 8.200us/op -> 8.019us/op (-2.21%).SetWithRevision_inline_64x32x96: allocation result statistically unchanged.SetViewValidatedWithRevision_pointer_64x32x2048: 640 B/op and 1 alloc/op unchanged.Focused
alloc_spaceprofile delta:SetWithRevision993.20kB flat / 1.87MB cum; lineptrValueIdxs = append(...)accounts for the flat allocation.SetWithRevision0 flat / 956.87kB cum;appendPtrValueIdxaccounts for 4.50kB in the 1000x profile sample.Tests
GOWORK=off TMPDIR=/mnt/fast4tb/tmp go test ./TreeDB/caching -run 'TestBatchCloseReleasesAuxiliaryIndexSlices|TestBatchAppendPtrValueIdxReservesEntryCapacity|TestBatchPtrValueArena'GOWORK=off TMPDIR=/mnt/fast4tb/tmp go test ./TreeDB/cachingGOWORK=off TMPDIR=/mnt/fast4tb/tmp go test ./TreeDB/caching -run '^$' -bench 'BenchmarkBatchSetWithRevisionAllocationShape' -benchmem -count=5GOWORK=off TMPDIR=/mnt/fast4tb/tmp go test ./TreeDB/caching -run '^$' -bench '^BenchmarkBatchSetWithRevisionAllocationShape/SetWithRevision_pointer_64x32x2048$' -benchmem -benchtime=1000x -count=1 -memprofile /mnt/fast4tb/tmp/gomap-3526-setwithrevision-20260706T085722Z/setwithrevision_pointer_after_mem.pprof -memprofilerate=1No AI review requested. Not merged.
Fixes #3526