Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 284: writeByte() may be improved for byte array based BufferedData #285

Merged
merged 1 commit into from
Sep 11, 2024

Conversation

artemananiev
Copy link
Member

Fix summary:

  • Introduced writeByte2(), writeByte3(), and writeByte4() methods to WritableSequentialData
  • By default, the methods just call writeByte() the right number of times
  • In ByteArrayBufferedData the methods are implemented more efficiently than N calls to writeByte()

Performance:

  • In ProtobufObjectBench, writing Everything to byte array output is about 12% faster than previously

Fixes: #284
Signed-off-by: Artem Ananev artem.ananev@swirldslabs.com

Signed-off-by: Artem Ananev <artem.ananev@swirldslabs.com>
@artemananiev artemananiev added the Performance Issues related to performance concerns. label Sep 9, 2024
@artemananiev artemananiev self-assigned this Sep 9, 2024
Copy link

github-actions bot commented Sep 9, 2024

JUnit Test Report

   55 files  ±0     55 suites  ±0   2m 10s ⏱️ -8s
1 201 tests ±0  1 199 ✅ ±0   2 💤 ±0  0 ❌ ±0 
7 056 runs  ±0  7 038 ✅ ±0  18 💤 ±0  0 ❌ ±0 

Results for commit 80b5b22. ± Comparison against base commit 223a232.

This pull request removes 8 and adds 7 tests. Note that renamed tests count towards both.
, 1
com.hedera.pbj.runtime.ProtoWriterToolsTest ‑ [1] FLOAT, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00007fc084309be0@3feebf9c, [0.1, 0.5, 100.0], 12, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00007fc084309df8@305e95a4
com.hedera.pbj.runtime.ProtoWriterToolsTest ‑ [1] STRING, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00007fc08431c430@2d07aacc, [string 1, testing here, testing there], com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00007fc08431c648@ff5d4f1
com.hedera.pbj.runtime.ProtoWriterToolsTest ‑ [2] BYTES, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00007fc08431c860@1c2096c6, [010203, ff7f0f, 42da07370bff], com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00007fc08431ca78@1a89414e
com.hedera.pbj.runtime.ProtoWriterToolsTest ‑ [2] DOUBLE, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00007fc08430a010@2b5f8e61, [0.1, 0.5, 100.0, 1.7653472635472653E240], 32, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00007fc08430a228@6ba0ee4a
com.hedera.pbj.runtime.ProtoWriterToolsTest ‑ [3] BOOL, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00007fc08430a440@73b0ed03, [true, false, false, true, true, true], 6, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00007fc08430a658@55061418
com.hedera.pbj.runtime.ProtoWriterToolsTest ‑ [4] ENUM, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00007fc08430a870@27db45f, [Mock for EnumWithProtoMetadata, hashCode: 1739974163, Mock for EnumWithProtoMetadata, hashCode: 438772947, Mock for EnumWithProtoMetadata, hashCode: 2111381500], 3, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00007fc08430aa88@2c3f43d1
com.hedera.pbj.runtime.Utf8ToolsTest ‑ [4] 
com.hedera.pbj.runtime.ProtoWriterToolsTest ‑ [1] FLOAT, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00007f853c309be0@3feebf9c, [0.1, 0.5, 100.0], 12, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00007f853c309df8@305e95a4
com.hedera.pbj.runtime.ProtoWriterToolsTest ‑ [1] STRING, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00007f853c31c430@2d07aacc, [string 1, testing here, testing there], com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00007f853c31c648@ff5d4f1
com.hedera.pbj.runtime.ProtoWriterToolsTest ‑ [2] BYTES, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00007f853c31c860@1c2096c6, [010203, ff7f0f, 42da07370bff], com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00007f853c31ca78@1a89414e
com.hedera.pbj.runtime.ProtoWriterToolsTest ‑ [2] DOUBLE, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00007f853c30a010@2b5f8e61, [0.1, 0.5, 100.0, 1.7653472635472653E240], 32, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00007f853c30a228@6ba0ee4a
com.hedera.pbj.runtime.ProtoWriterToolsTest ‑ [3] BOOL, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00007f853c30a440@73b0ed03, [true, false, false, true, true, true], 6, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00007f853c30a658@55061418
com.hedera.pbj.runtime.ProtoWriterToolsTest ‑ [4] ENUM, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00007f853c30a870@27db45f, [Mock for EnumWithProtoMetadata, hashCode: 1739974163, Mock for EnumWithProtoMetadata, hashCode: 438772947, Mock for EnumWithProtoMetadata, hashCode: 2111381500], 3, com.hedera.pbj.runtime.ProtoWriterToolsTest$$Lambda/0x00007f853c30aa88@2c3f43d1
com.hedera.pbj.runtime.Utf8ToolsTest ‑ [4] 
, 1

Copy link

github-actions bot commented Sep 9, 2024

Integration Test Report

    289 files  ±0      289 suites  ±0   9m 54s ⏱️ + 2m 46s
103 729 tests ±0  103 729 ✅ ±0  0 💤 ±0  0 ❌ ±0 
103 957 runs  ±0  103 957 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 80b5b22. ± Comparison against base commit 223a232.

This pull request removes 3 and adds 3 tests. Note that renamed tests count towards both.
com.hedera.pbj.intergration.test.ParserNeverWrapsTest ‑ [1] com.hedera.pbj.intergration.test.ParserNeverWrapsTest$$Lambda/0x00007fc4b04c2e60@6da5c6a2
com.hedera.pbj.intergration.test.ParserNeverWrapsTest ‑ [2] com.hedera.pbj.intergration.test.ParserNeverWrapsTest$$Lambda/0x00007fc4b04c3098@5cde0872
com.hedera.pbj.intergration.test.ParserNeverWrapsTest ‑ [3] com.hedera.pbj.intergration.test.ParserNeverWrapsTest$$Lambda/0x00007fc4b04c32d0@154669ef
com.hedera.pbj.intergration.test.ParserNeverWrapsTest ‑ [1] com.hedera.pbj.intergration.test.ParserNeverWrapsTest$$Lambda/0x00007f40984b6ac0@693702d7
com.hedera.pbj.intergration.test.ParserNeverWrapsTest ‑ [2] com.hedera.pbj.intergration.test.ParserNeverWrapsTest$$Lambda/0x00007f40984b6cf8@758b06ba
com.hedera.pbj.intergration.test.ParserNeverWrapsTest ‑ [3] com.hedera.pbj.intergration.test.ParserNeverWrapsTest$$Lambda/0x00007f40984b6f30@5dcfc73d

@artemananiev artemananiev merged commit 04b45cd into main Sep 11, 2024
10 checks passed
@artemananiev artemananiev deleted the 284-M-bytearraybuffereddata-writebyte-perf branch September 11, 2024 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Performance Issues related to performance concerns.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

writeByte() may be improved for byte array based BufferedData
3 participants