xdr: comprehensive XDR decoding optimization#5893
Draft
tamirms wants to merge 1 commit intostellar:mainfrom
Draft
xdr: comprehensive XDR decoding optimization#5893tamirms wants to merge 1 commit intostellar:mainfrom
tamirms wants to merge 1 commit intostellar:mainfrom
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
45d3678 to
1a6769a
Compare
Regenerate XDR bindings and update handwritten code with multiple
performance optimizations for XDR decoding.
Key changes:
1. Buffer-based decoding
- xdr.Unmarshal now takes []byte instead of io.Reader
- Direct buffer access eliminates io.Reader dispatch overhead
- Use xdr.Decoder directly for primitive decoding in strkey package
- New Decoder.Decode() method simplifies decode calls
2. Union value-type optimization
- Primitive union arms (Bool, Int32, Uint32, Int64, Uint64, etc.)
stored as values instead of pointers, reducing allocations
- Complex union arms (ScVec, ScMap, structs) remain as pointers
- Direct field access for union arms instead of accessor methods
3. Generated accessor improvements
- GetX() accessors return (value, bool) for optional handling
- MustX() accessors for cases where arm is known to be set
4. Object pooling support
- XDR types support pooling via Pool[T] generic type
- Enables reuse of decoded objects to reduce GC pressure
Performance improvement (LedgerCloseMeta decode, 100 varied ledgers):
Without pooling:
- Latency: 5.31ms → 3.45ms (-35%)
- Throughput: 277 MB/s → 426 MB/s (+54%)
- Memory: 8.06 MB → 7.46 MB (-7.5%)
- Allocations: 107.7k → 90.7k (-16%)
With pooling:
- Latency: 5.31ms → 2.58ms (-51%)
- Throughput: 277 MB/s → 570 MB/s (+106%)
- Memory: 8.06 MB → 2.64 MB (-67%)
- Allocations: 107.7k → 33.6k (-69%)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Shaptic
reviewed
Jan 6, 2026
Contributor
There was a problem hiding this comment.
Are there going to be xdrgen changes to match the new decoding patterns?
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.
Regenerate XDR bindings and update handwritten code with multiple performance optimizations for XDR decoding.
Key changes:
Buffer-based decoding
Union value-type optimization
Generated accessor improvements
Object pooling support
Performance improvement (LedgerCloseMeta decode, 100 varied ledgers):
Without pooling:
With pooling:
🤖 Generated with Claude Code