Repository navigation
perf(storage): retain decoded inline values - #244
Merged
Merged
Conversation
Signed-off-by: Perfloop Agent <[email protected]>
Signed-off-by: Perfloop Agent <[email protected]>
Signed-off-by: Perfloop Agent <[email protected]>
Signed-off-by: Perfloop Agent <[email protected]>
Greptile SummaryThe PR removes a redundant copy when returning decoded INLINE values from paginated storage listings while preserving ownership beyond the RocksDB iterator lifetime.
Confidence Score: 5/5The PR appears safe to merge with no actionable correctness, security, build, or benchmark issues identified. The decoded inline bytes have independent ownership, are not reused or mutated in the response path, and the added benchmark cases remain within the list limits. Important Files Changed
Reviews (1): Last reviewed commit: "test: guard list fixture cleanup" | Re-trigger Greptile |
ovaistariq
approved these changes
Aug 28, 2026
|
🎉 This PR is included in version 1.12.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
The change
ListKeyValuesWithPaginationnow retains the protobuf decoder's ownedDatafor capped INLINE values instead of allocating and copying it a second time. The decoder still separates the data from the RocksDB iterator, which is closed after decoding. The existing size cap and SEGMENT/RAW_FILE branches are unchanged.The service benchmark covers 4 KiB and 64 KiB inline values at page sizes of 1, 100, and 1,000.
Testing:
make lintmake license-checkmake test-server TEST=TestCacheService_ListWithValuesRetainsInlineDatamake test-storage TEST=TestListKeyValuesWithPagination_OmitsOversizeValuesWorkload:
ListWithValues INLINE 4 KiB page of 1B/opWorkload:
ListWithValues INLINE 4 KiB page of 100B/opWorkload:
ListWithValues INLINE 4 KiB page of 1,000B/opWorkload:
ListWithValues INLINE 64 KiB page of 1B/opWorkload:
ListWithValues INLINE 64 KiB page of 100B/opWorkload:
ListWithValues INLINE 64 KiB page of 1,000B/opGenerated by Perfloop. Measurements and checks.
Note
Medium Risk
Changes memory ownership on a hot list path; mitigated by a regression test that closes storage before asserting value bytes, but incorrect assumptions about protobuf decode lifetimes could cause subtle corruption.
Overview
List-with-values for inline objects no longer allocates and copies payload bytes after
proto.Unmarshal; it reuses the decoder-ownedDataslice instead, cutting roughly half the bytes allocated perListWithValuescall in the reported benchmarks. Oversize omission, segment, and raw-file read paths are unchanged.Adds
BenchmarkCacheServiceListWithValues(4 KiB / 64 KiB × page sizes 1, 100, 1000) plusTestCacheService_ListWithValuesRetainsInlineData, which closes storage after the list returns to prove returned inline bytes are not tied to RocksDB iterator memory. The Makefile gainsbuild-bench-cache-service-list-with-valuesfor precompiled Perfloop runs.Reviewed by Cursor Bugbot for commit 5e9b155. Bugbot is set up for automated code reviews on this repo. Configure here.