feat: SDK memory optimization — sketch pooling, series ID fast-path, label heap free - #42
Merged
zzylol merged 1 commit intoMar 15, 2026
Conversation
Updates patch copies of all five sketch aggregators, dictionary, and metricdata with the Reset()-based sync.Pool recycling, SeriesIDSink fast-path, and AttrsClearer label heap free changes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
zzylol
force-pushed
the
37-sdk-optimization---only-store-labels-once-not-twice
branch
from
March 15, 2026 07:47
8f0d591 to
1e9b69c
Compare
zzylol
deleted the
37-sdk-optimization---only-store-labels-once-not-twice
branch
March 15, 2026 07:49
2 tasks
SieDeta
pushed a commit
that referenced
this pull request
Apr 17, 2026
…ore-labels-once-not-twice feat: SDK memory optimization — sketch pooling, series ID fast-path, label heap free
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.
Summary
Reset()/Clear()instead of reallocated each export cycle. Eliminates up to ~197 KB of heap churn per series per delta export for CountMinSketch.series.attrsvia a back-pointer, permanently freeing the[]KeyValueheap array (~224 bytes per 5-label series).sync.Poolfor*strings.Builderand*seriesEntry; generation-based eviction (staleGenerations=5) for stale series; idle-series eviction in cumulative aggregators (maxIdleCycles=3) to handle dynamic label churn.Sketch aggregators added
Test plan
go test ./sdk/metric/...passesgo test ./sdk/metric/internal/aggregate/...passesgo build ./...🤖 Generated with Claude Code