feat: introduce writeTo(byte[])#614
Merged
anthony-swirldslabs merged 4 commits intomainfrom Sep 17, 2025
Merged
Conversation
Signed-off-by: Anthony Petrov <anthony@swirldslabs.com>
JUnit Test Report 77 files ±0 77 suites ±0 3m 30s ⏱️ -27s Results for commit 47c1b51. ± Comparison against base commit 28f0a82. This pull request removes 8 and adds 7 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
Integration Test Report 405 files +1 405 suites +1 18m 2s ⏱️ +51s Results for commit 47c1b51. ± Comparison against base commit 28f0a82. This pull request removes 3 and adds 4 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
pbj-core/pbj-grpc-helidon/src/test/java/com/hedera/pbj/grpc/helidon/PbjTest.java
Show resolved
Hide resolved
pbj-core/pbj-runtime/src/main/java/com/hedera/pbj/runtime/Utf8Tools.java
Show resolved
Hide resolved
pbj-core/pbj-runtime/src/main/java/com/hedera/pbj/runtime/Utf8Tools.java
Outdated
Show resolved
Hide resolved
...ava/com/hedera/pbj/compiler/impl/generators/protobuf/CodecWriteByteArrayMethodGenerator.java
Show resolved
Hide resolved
...ava/com/hedera/pbj/compiler/impl/generators/protobuf/CodecWriteByteArrayMethodGenerator.java
Show resolved
Hide resolved
Signed-off-by: Anthony Petrov <anthony@swirldslabs.com>
imalygin
reviewed
Sep 17, 2025
imalygin
reviewed
Sep 17, 2025
...ava/com/hedera/pbj/compiler/impl/generators/protobuf/CodecWriteByteArrayMethodGenerator.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Anthony Petrov <anthony@swirldslabs.com>
imalygin
previously approved these changes
Sep 17, 2025
Signed-off-by: Anthony Petrov <anthony@swirldslabs.com>
imalygin
approved these changes
Sep 17, 2025
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.
Description:
This is a part of an original proof of concept PR at #612 .
Introducing an ability to write protobuf data to pre-existing byte arrays. This allows client code to reuse the same byte array for multiple write operations and avoid allocating new arrays or buffers for this purpose. This also enables certain optimizations, such as a more efficient writing of varint data types where the write operation can start directly from a byte at a larger index, and then descend gradually writing to lesser significant bytes.
In the new
ProtoArrayWriterTools.java, the current PR already implements the optimized version of varint writing. There'll be a follow-up PR focusing on varints specifically that would add benchmarks, but they are outside of scope of this particular PR.Related issue(s):
Fixes #613
Notes for reviewer:
All tests should pass. This is a new API, so no existing code is affected.
Checklist