Skip to content

perf: fast-paths for MemoryData#785

Merged
anthony-swirldslabs merged 3 commits intomainfrom
784-fastPathMemoryData
Apr 15, 2026
Merged

perf: fast-paths for MemoryData#785
anthony-swirldslabs merged 3 commits intomainfrom
784-fastPathMemoryData

Conversation

@anthony-swirldslabs
Copy link
Copy Markdown
Contributor

Description:
Implementing all possible fast-paths for the MemoryData. As a reminder, it's covered by the existing BufferedDataTestBase, so we cover all the new methods via the existing unit tests.

As a side-effect, Bytes get two new convenience APIs: toMemorySegment() and writeTo(MemorySegment segment, long position).

Related issue(s):

Fixes #784

Notes for reviewer:
All tests pass.

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

Signed-off-by: Anthony Petrov <anthony@swirldslabs.com>
@anthony-swirldslabs anthony-swirldslabs self-assigned this Apr 14, 2026
@anthony-swirldslabs anthony-swirldslabs requested review from a team as code owners April 14, 2026 22:19
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 14, 2026

JUnit Test Report

    81 files  ±0      81 suites  ±0   3m 18s ⏱️ +30s
 1 519 tests +3   1 515 ✅ +3   4 💤 ±0  0 ❌ ±0 
10 407 runs  +7  10 379 ✅ +7  28 💤 ±0  0 ❌ ±0 

Results for commit 5c434af. ± Comparison against base commit d163702.

This pull request removes 6 and adds 9 tests. Note that renamed tests count towards both.
com.hedera.pbj.runtime.ProtoWriterToolsTest ‑ [1] FLOAT, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x0000000047497730@6e70861, [0.1, 0.5, 100.0], 12, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x0000000047497958@5fcff272
com.hedera.pbj.runtime.ProtoWriterToolsTest ‑ [1] STRING, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x000000004749fcf0@684eb4a0, [string 1, testing here, testing there], com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00000000474a4000@19a4cdea
com.hedera.pbj.runtime.ProtoWriterToolsTest ‑ [2] BYTES, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00000000474a4228@491f3fb0, [010203, ff7f0f, 42da07370bff], com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00000000474a4450@58a0f75b
com.hedera.pbj.runtime.ProtoWriterToolsTest ‑ [2] DOUBLE, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x0000000047497b80@1a3611b1, [0.1, 0.5, 100.0, 1.7653472635472653E240], 32, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x0000000047497da8@419ece7a
com.hedera.pbj.runtime.ProtoWriterToolsTest ‑ [3] BOOL, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x000000004749c000@238d27ef, [true, false, false, true, true, true], 6, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x000000004749c228@91c11b6
com.hedera.pbj.runtime.ProtoWriterToolsTest ‑ [4] ENUM, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x000000004749c450@1dfd6023, [0, 2, 1], 3, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x000000004749c678@57859e2c
com.hedera.pbj.runtime.ProtoWriterToolsTest ‑ [1] FLOAT, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x0000000074499120@34766f4b, [0.1, 0.5, 100.0], 12, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x0000000074499348@4d204b30
com.hedera.pbj.runtime.ProtoWriterToolsTest ‑ [1] STRING, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00000000744a57c8@6939f18a, [string 1, testing here, testing there], com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00000000744a59f0@8bd9d08
com.hedera.pbj.runtime.ProtoWriterToolsTest ‑ [2] BYTES, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00000000744a5c18@6c2a33af, [010203, ff7f0f, 42da07370bff], com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00000000744a5e40@44ba9f25
com.hedera.pbj.runtime.ProtoWriterToolsTest ‑ [2] DOUBLE, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x0000000074499570@220d7eb7, [0.1, 0.5, 100.0, 1.7653472635472653E240], 32, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x0000000074499798@a165c11
com.hedera.pbj.runtime.ProtoWriterToolsTest ‑ [3] BOOL, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00000000744999c0@5006a697, [true, false, false, true, true, true], 6, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x0000000074499be8@193792e6
com.hedera.pbj.runtime.ProtoWriterToolsTest ‑ [4] ENUM, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x0000000074499e10@6ff87203, [0, 2, 1], 3, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x000000007449a038@aaf4375
com.hedera.pbj.runtime.io.ReadableSequentialDataTest ‑ Read past the ByteBuffer - EOF
com.hedera.pbj.runtime.io.buffer.BufferedDataTestBase$ReadableSequentialDataTest ‑ Read past the ByteBuffer - EOF
com.hedera.pbj.runtime.io.stream.ReadableStreamingDataTest ‑ Read past the ByteBuffer - EOF

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 14, 2026

Integration Test Report

    419 files  ±0      419 suites  ±0   23m 17s ⏱️ + 5m 52s
114 982 tests ±0  114 982 ✅ ±0  0 💤 ±0  0 ❌ ±0 
115 224 runs  ±0  115 224 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 5c434af. ± Comparison against base commit d163702.

This pull request removes 3 and adds 3 tests. Note that renamed tests count towards both.
com.hedera.pbj.integration.test.ParserNeverWrapsTest ‑ [1] com.hedera.pbj.integration.test.ParserNeverWrapsTest$$Lambda/0x000000007cc65dd0@45bf0af0
com.hedera.pbj.integration.test.ParserNeverWrapsTest ‑ [2] com.hedera.pbj.integration.test.ParserNeverWrapsTest$$Lambda/0x000000007cc66018@2add4c8a
com.hedera.pbj.integration.test.ParserNeverWrapsTest ‑ [3] com.hedera.pbj.integration.test.ParserNeverWrapsTest$$Lambda/0x000000007cc66260@100b623d
com.hedera.pbj.integration.test.ParserNeverWrapsTest ‑ [1] com.hedera.pbj.integration.test.ParserNeverWrapsTest$$Lambda/0x0000000034b90690@70c1c7f
com.hedera.pbj.integration.test.ParserNeverWrapsTest ‑ [2] com.hedera.pbj.integration.test.ParserNeverWrapsTest$$Lambda/0x0000000034b908d8@144e6141
com.hedera.pbj.integration.test.ParserNeverWrapsTest ‑ [3] com.hedera.pbj.integration.test.ParserNeverWrapsTest$$Lambda/0x0000000034b90b20@ad0cbb4

♻️ This comment has been updated with latest results.

Signed-off-by: Anthony Petrov <anthony@swirldslabs.com>
Signed-off-by: Anthony Petrov <anthony@swirldslabs.com>
@anthony-swirldslabs anthony-swirldslabs merged commit c56b2a7 into main Apr 15, 2026
16 checks passed
@anthony-swirldslabs anthony-swirldslabs deleted the 784-fastPathMemoryData branch April 15, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement fast-paths for MemoryData

2 participants