Optimize packed fixed-size repeated I/O - #199
Merged
Merged
Conversation
Add fast little-endian memcopy paths for packed fixed-size repeated fields. Introduces src/LightProto/Serializer.PackedRepeated.cs with TryWritePackedRepeatedFieldLittleEndian, ParseRepeatedFieldIntoSpan and TryReadPackedRepeatedFieldLittleEndian (with NET5/NET8 optimizations). Update generator (Helper.cs) and parser files (Array.cs, IEnumerableReader.cs, IEnumerableWriter.cs) to use the fast paths; add ParsingPrimitives.ReadPackedFieldLittleEndian and update PublicAPI.Unshipped. Add tests for packed fixed32 serialization and ReadOnlySequence splitting in FixedSizePackedArrayTests and FixedSizePackedListTests. Improves performance and correctness when reading/writing packed primitive arrays/lists.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 41 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Move packed-repeated helper methods out of Serializer into a new PackedRepeatedOptimizer class (rename file and update type). Update generator and parser/writer call sites to use PackedRepeatedOptimizer. Add NETSTANDARD2_0-safe CreateSpan implementation and switch to itemReader.ParseMessageFrom calls. Update PublicAPI.Unshipped lists to reflect the new API surface. Refactor-only and adds span compatibility for netstandard2.0; behavior unchanged.
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (80.73%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #199 +/- ##
==========================================
- Coverage 95.67% 95.19% -0.49%
==========================================
Files 124 125 +1
Lines 3287 3394 +107
Branches 441 464 +23
==========================================
+ Hits 3145 3231 +86
- Misses 76 90 +14
- Partials 66 73 +7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This comment has been minimized.
This comment has been minimized.
|
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.
Add fast little-endian memcopy paths for packed fixed-size repeated fields. Introduces src/LightProto/Serializer.PackedRepeated.cs with TryWritePackedRepeatedFieldLittleEndian, ParseRepeatedFieldIntoSpan and TryReadPackedRepeatedFieldLittleEndian (with NET5/NET8 optimizations). Update generator (Helper.cs) and parser files (Array.cs, IEnumerableReader.cs, IEnumerableWriter.cs) to use the fast paths; add ParsingPrimitives.ReadPackedFieldLittleEndian and update PublicAPI.Unshipped. Add tests for packed fixed32 serialization and ReadOnlySequence splitting in FixedSizePackedArrayTests and FixedSizePackedListTests. Improves performance and correctness when reading/writing packed primitive arrays/lists.