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

60: Improve BufferedData Performance #120

Merged
merged 7 commits into from
Nov 29, 2023

Conversation

artemananiev
Copy link
Member

Fix summary:

  • Two subclasses of BufferedData are provided: ByteArrayBufferedData and DirectBufferedData
  • Byte array version uses System.arraycopy() to get / read / write bytes
  • Direct version uses UnsafeUtils methods to get / read / write bytes
  • A new BufferedData level JMH benchmark is provided
  • New unit tests are provided for the two new subclasses
  • A couple unit tests which were specific to Bytes are made generic, so they are applicable to other random access data implementations, including BufferedData and its subclasses

Fixes: #60
Signed-off-by: Artem Ananev [email protected]

@artemananiev artemananiev added the Performance Issues related to performance concerns. label Nov 18, 2023
@artemananiev artemananiev self-assigned this Nov 18, 2023
Copy link

github-actions bot commented Nov 18, 2023

JUnit Test Report

     43 files  +       4       43 suites  +4   3m 36s ⏱️ + 1m 28s
   701 tests +   197     700 ✔️ +   197    1 💤 ±0  0 ±0 
5 714 runs  +3 022  5 696 ✔️ +3 013  18 💤 +9  0 ±0 

Results for commit 2960fc0. ± Comparison against base commit e903783.

This pull request removes 66 and adds 262 tests. Note that renamed tests count towards both.
, 1
com.hedera.pbj.runtime.Utf8ToolsTest ‑ [4] 
com.hedera.pbj.runtime.io.BytesTest ‑ Appends RandomAccessData
com.hedera.pbj.runtime.io.BytesTest ‑ Appends two Bytes objects
com.hedera.pbj.runtime.io.BytesTest ‑ Appends two Bytes objects, one empty
com.hedera.pbj.runtime.io.BytesTest ‑ Changed toString
com.hedera.pbj.runtime.io.BytesTest ‑ Changed toString2
com.hedera.pbj.runtime.io.BytesTest ‑ Empty bytes String is not null
com.hedera.pbj.runtime.io.BytesTest ‑ Empty bytes have length of 0
com.hedera.pbj.runtime.io.BytesTest ‑ Empty bytes have no data
…
com.hedera.pbj.runtime.Utf8ToolsTest ‑ [4] 
, 1
com.hedera.pbj.runtime.io.buffer.BufferedDataTest ‑ allocated data length test
com.hedera.pbj.runtime.io.buffer.BufferedDataTest ‑ getBytesLeavesPositionBufferedData()
com.hedera.pbj.runtime.io.buffer.BufferedDataTest ‑ getBytesLeavesPositionByteBuffer()
com.hedera.pbj.runtime.io.buffer.BufferedDataTest ‑ readBytes() does always copy
com.hedera.pbj.runtime.io.buffer.BufferedDataTest ‑ toStringWithOffsetAndLen()
com.hedera.pbj.runtime.io.buffer.BufferedDataTest ‑ toStringWithSlice()
com.hedera.pbj.runtime.io.buffer.BufferedDataTest ‑ wrapped data length test
com.hedera.pbj.runtime.io.buffer.BufferedDataTest ‑ wrapped data with offset length test
com.hedera.pbj.runtime.io.buffer.BufferedDataTest ‑ wrapped sliced data length test
…

♻️ This comment has been updated with latest results.

Copy link
Contributor

codacy-production bot commented Nov 18, 2023

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+3.83% (target: -1.00%) 81.29%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (e903783) 3741 1013 27.08%
Head commit (2960fc0) 3973 (+232) 1228 (+215) 30.91% (+3.83%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#120) 310 252 81.29%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Copy link

github-actions bot commented Nov 18, 2023

Integration Test Report

86 963 tests  ±0   86 963 ✔️ ±0   4m 53s ⏱️ - 3m 57s
     213 suites ±0            0 💤 ±0 
     213 files   ±0            0 ±0 

Results for commit 2960fc0. ± Comparison against base commit e903783.

♻️ This comment has been updated with latest results.

@artemananiev artemananiev added this to the 0.7.8 milestone Nov 29, 2023
@artemananiev artemananiev merged commit adaa794 into main Nov 29, 2023
9 of 10 checks passed
@artemananiev artemananiev deleted the 00060-M-buffereddata-performance branch November 29, 2023 22:55
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.

Improve BufferedData Performance
3 participants