Skip to content

feat: introduce MemoryData#781

Merged
anthony-swirldslabs merged 2 commits intomainfrom
780-MemoryData
Apr 14, 2026
Merged

feat: introduce MemoryData#781
anthony-swirldslabs merged 2 commits intomainfrom
780-MemoryData

Conversation

@anthony-swirldslabs
Copy link
Copy Markdown
Contributor

@anthony-swirldslabs anthony-swirldslabs commented Apr 10, 2026

Description:
Introducing the initial implementation of the new MemoryData class - an object similar to the BufferedData, but backed by a MemorySegment rather than a ByteBuffer.
This initial implementation supports all the interfaces that the BufferedData supports and exposes pretty much the same API. However, currently, no fast-paths exist for more optimal operations. So this initial version isn't production ready yet. Fast-paths will be delivered in future, separate PRs.

See parent story for more details: #767

There's also a one-liner fix in a Gradle script that removes a warning during the build.

Related issue(s):

Fixes #780

Notes for reviewer:
Existing BufferedData unit tests have been modified to support the new MemoryData object. So the test coverage is identical for both the classes.

Checklist

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

Signed-off-by: Anthony Petrov <anthony@swirldslabs.com>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 10, 2026

JUnit Test Report

    81 files  +    2      81 suites  +2   2m 48s ⏱️ -35s
 1 516 tests +  162   1 512 ✅ +  162   4 💤 ±0  0 ❌ ±0 
10 400 runs  +3 164  10 372 ✅ +3 156  28 💤 +8  0 ❌ ±0 

Results for commit 46cf9c5. ± Comparison against base commit 9a572a5.

This pull request removes 6 and adds 168 tests. Note that renamed tests count towards both.
com.hedera.pbj.runtime.ProtoWriterToolsTest ‑ [1] FLOAT, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x0000000055496908@1e2bc241, [0.1, 0.5, 100.0], 12, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x0000000055496b30@543196f9
com.hedera.pbj.runtime.ProtoWriterToolsTest ‑ [1] STRING, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00000000554a0ad8@33986be7, [string 1, testing here, testing there], com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00000000554a0d00@748fa354
com.hedera.pbj.runtime.ProtoWriterToolsTest ‑ [2] BYTES, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00000000554a0f28@1e12fdcf, [010203, ff7f0f, 42da07370bff], com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00000000554a1150@2003edf
com.hedera.pbj.runtime.ProtoWriterToolsTest ‑ [2] DOUBLE, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x0000000055496d58@b307030, [0.1, 0.5, 100.0, 1.7653472635472653E240], 32, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x0000000055496f80@2caa9666
com.hedera.pbj.runtime.ProtoWriterToolsTest ‑ [3] BOOL, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00000000554971a8@49741e80, [true, false, false, true, true, true], 6, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00000000554973d0@414d466e
com.hedera.pbj.runtime.ProtoWriterToolsTest ‑ [4] ENUM, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00000000554975f8@643a73fa, [0, 2, 1], 3, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x0000000055497820@dd3e1e3
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.io.buffer.MemoryDataTest ‑ [10] 1024
com.hedera.pbj.runtime.io.buffer.MemoryDataTest ‑ [10] 32
com.hedera.pbj.runtime.io.buffer.MemoryDataTest ‑ [11] 1025
com.hedera.pbj.runtime.io.buffer.MemoryDataTest ‑ [11] 33
…

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 10, 2026

Integration Test Report

    419 files  ±0      419 suites  ±0   17m 25s ⏱️ - 6m 29s
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 46cf9c5. ± Comparison against base commit 9a572a5.

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/0x0000000062ba8a30@6a3b7516
com.hedera.pbj.integration.test.ParserNeverWrapsTest ‑ [2] com.hedera.pbj.integration.test.ParserNeverWrapsTest$$Lambda/0x0000000062ba8c78@1502c739
com.hedera.pbj.integration.test.ParserNeverWrapsTest ‑ [3] com.hedera.pbj.integration.test.ParserNeverWrapsTest$$Lambda/0x0000000062bb0000@1edbaafd
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

♻️ This comment has been updated with latest results.

Signed-off-by: Anthony Petrov <anthony@swirldslabs.com>
@anthony-swirldslabs anthony-swirldslabs merged commit d163702 into main Apr 14, 2026
16 checks passed
@anthony-swirldslabs anthony-swirldslabs deleted the 780-MemoryData branch April 14, 2026 19:18
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.

Introduce MemoryData

2 participants