205 random access data performance clean v2#605
Merged
anthony-swirldslabs merged 4 commits intohashgraph:mainfrom Sep 17, 2025
Merged
Conversation
Contributor
Author
|
The DCO seems to still be having issues. I might need a walkthrough of how to do this correctly. EDIT: Got it. Had to dig into the docs further |
997338d to
4440f8b
Compare
Contributor
anthony-swirldslabs
left a comment
There was a problem hiding this comment.
Thanks for the contribution! Overall, the fix looks good to me. But I posted a few comments. Please have a look.
kaldun-tech
added a commit
to kaldun-tech/hedera-pbj
that referenced
this pull request
Sep 16, 2025
…nsive benchmarks Addresses code review feedback on PR hashgraph#605 by improving threshold analysis and resolving small array performance regression. Changes: - Increase BULK_COMPARISON_THRESHOLD from 8 to 32 bytes based on performance testing - Add comprehensive benchmarks for pattern sizes 4, 8, 16, 32, 64, 128, 256 bytes - Add original implementation benchmarks for baseline comparison - Create DirectBufferedDataThresholdTest utility for quick threshold analysis - Update both contains() method variants to use consistent threshold Performance results with 32-byte threshold: - Small arrays (≤32 bytes): Use byte-by-byte comparison (no allocation overhead) - Large arrays (64+ bytes): Use bulk optimization (up to 5.6x speedup for 256 bytes) - Eliminates small array performance regression noted in code review
4440f8b to
e000088
Compare
Contributor
Author
|
@anthony-swirldslabs I believe your concerns are now correctly addressed |
anthony-swirldslabs
previously approved these changes
Sep 16, 2025
Contributor
anthony-swirldslabs
left a comment
There was a problem hiding this comment.
@anthony-swirldslabs I believe your concerns are now correctly addressed
Great work. Thank you! The code changes look good to me. Could you please fix the DCO check one last time so that we can merge the PR?
kaldun-tech
added a commit
to kaldun-tech/hedera-pbj
that referenced
this pull request
Sep 16, 2025
…nsive benchmarks Addresses code review feedback on PR hashgraph#605 by improving threshold analysis and resolving small array performance regression. Changes: - Increase BULK_COMPARISON_THRESHOLD from 8 to 32 bytes based on performance testing - Add comprehensive benchmarks for pattern sizes 4, 8, 16, 32, 64, 128, 256 bytes - Add original implementation benchmarks for baseline comparison - Create DirectBufferedDataThresholdTest utility for quick threshold analysis - Update both contains() method variants to use consistent threshold Performance results with 32-byte threshold: - Small arrays (≤32 bytes): Use byte-by-byte comparison (no allocation overhead) - Large arrays (64+ bytes): Use bulk optimization (up to 5.6x speedup for 256 bytes) - Eliminates small array performance regression noted in code review Signed-off-by: kaldun-tech <tsmereka@protonmail.com>
e000088 to
e268248
Compare
kaldun-tech
added a commit
to kaldun-tech/hedera-pbj
that referenced
this pull request
Sep 17, 2025
…nsive benchmarks Addresses code review feedback on PR hashgraph#605 by improving threshold analysis and resolving small array performance regression. Changes: - Increase BULK_COMPARISON_THRESHOLD from 8 to 32 bytes based on performance testing - Add comprehensive benchmarks for pattern sizes 4, 8, 16, 32, 64, 128, 256 bytes - Add original implementation benchmarks for baseline comparison - Create DirectBufferedDataThresholdTest utility for quick threshold analysis - Update both contains() method variants to use consistent threshold Performance results with 32-byte threshold: - Small arrays (≤32 bytes): Use byte-by-byte comparison (no allocation overhead) - Large arrays (64+ bytes): Use bulk optimization (up to 5.6x speedup for 256 bytes) - Eliminates small array performance regression noted in code review Signed-off-by: kaldun-tech <tsmereka@protonmail.com>
e268248 to
47484ac
Compare
Contributor
Author
|
DCO should be fixed now |
kaldun-tech
commented
Sep 17, 2025
anthony-swirldslabs
approved these changes
Sep 17, 2025
Contributor
anthony-swirldslabs
left a comment
There was a problem hiding this comment.
LGTM. Thank you!
kaldun-tech
added a commit
to kaldun-tech/hedera-pbj
that referenced
this pull request
Sep 17, 2025
…nsive benchmarks Addresses code review feedback on PR hashgraph#605 by improving threshold analysis and resolving small array performance regression. Changes: - Increase BULK_COMPARISON_THRESHOLD from 8 to 32 bytes based on performance testing - Add comprehensive benchmarks for pattern sizes 4, 8, 16, 32, 64, 128, 256 bytes - Add original implementation benchmarks for baseline comparison - Create DirectBufferedDataThresholdTest utility for quick threshold analysis - Update both contains() method variants to use consistent threshold Performance results with 32-byte threshold: - Small arrays (≤32 bytes): Use byte-by-byte comparison (no allocation overhead) - Large arrays (64+ bytes): Use bulk optimization (up to 5.6x speedup for 256 bytes) - Eliminates small array performance regression noted in code review Signed-off-by: kaldun-tech <tsmereka@protonmail.com>
613c682 to
40d0459
Compare
anthony-swirldslabs
pushed a commit
to kaldun-tech/hedera-pbj
that referenced
this pull request
Sep 17, 2025
…nsive benchmarks Addresses code review feedback on PR hashgraph#605 by improving threshold analysis and resolving small array performance regression. Changes: - Increase BULK_COMPARISON_THRESHOLD from 8 to 32 bytes based on performance testing - Add comprehensive benchmarks for pattern sizes 4, 8, 16, 32, 64, 128, 256 bytes - Add original implementation benchmarks for baseline comparison - Create DirectBufferedDataThresholdTest utility for quick threshold analysis - Update both contains() method variants to use consistent threshold Performance results with 32-byte threshold: - Small arrays (≤32 bytes): Use byte-by-byte comparison (no allocation overhead) - Large arrays (64+ bytes): Use bulk optimization (up to 5.6x speedup for 256 bytes) - Eliminates small array performance regression noted in code review Signed-off-by: kaldun-tech <tsmereka@protonmail.com> Signed-off-by: Anthony Petrov <anthony@swirldslabs.com>
40d0459 to
0b93fdc
Compare
Signed-off-by: kaldun-tech <tsmereka@protonmail.com> Signed-off-by: Anthony Petrov <anthony@swirldslabs.com>
Refactored common code into bulkContains helper method for efficient memory operations on larger data sets (>8 bytes). Uses UnsafeUtils bulk operations instead of byte-by-byte comparison. Signed-off-by: kaldun-tech <tsmereka@protonmail.com> Signed-off-by: Anthony Petrov <anthony@swirldslabs.com>
…nsive benchmarks Addresses code review feedback on PR hashgraph#605 by improving threshold analysis and resolving small array performance regression. Changes: - Increase BULK_COMPARISON_THRESHOLD from 8 to 32 bytes based on performance testing - Add comprehensive benchmarks for pattern sizes 4, 8, 16, 32, 64, 128, 256 bytes - Add original implementation benchmarks for baseline comparison - Create DirectBufferedDataThresholdTest utility for quick threshold analysis - Update both contains() method variants to use consistent threshold Performance results with 32-byte threshold: - Small arrays (≤32 bytes): Use byte-by-byte comparison (no allocation overhead) - Large arrays (64+ bytes): Use bulk optimization (up to 5.6x speedup for 256 bytes) - Eliminates small array performance regression noted in code review Signed-off-by: kaldun-tech <tsmereka@protonmail.com> Signed-off-by: Anthony Petrov <anthony@swirldslabs.com>
Fixes Windows CRLF line endings that were inadvertently introduced in recent performance optimization commits. Signed-off-by: kaldun-tech <tsmereka@protonmail.com> Signed-off-by: Anthony Petrov <anthony@swirldslabs.com>
0b93fdc to
314a5cf
Compare
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:
Adds benchmarks and corrects performance issues in DirectBufferedData.contains()
Related issue(s):
Fixes #205
Notes for reviewer:
Added new performance benchmark to test with "./gradlew :pbj-runtime:jmh -Pjmh.include=".*DirectBufferedData.contains."
Addressed the small array regression by increasing
BULK_COMPARISON_THRESHOLDfrom 8 to 32 bytes based on comprehensive performance testing.09-16-25 Results of RandomAccessDataContainsBench before code changes to DirectedBufferedData (see branch 205-RandomAccessData-performance-benchmark):

09-16-25 Updated results of benchmarks with code changes:

This new test is run from pbj-core/pbj-runtime: java -cp "build/classes/java/main:build/classes/java/test" com.hedera.pbj.runtime.io.buffer.DirectBufferedDataThresholdTest
It measures the optimal threshold for DirectBufferedData.contains() and is much faster than running the full JMH benchmarks for threshold evaluation. This indicates that the previous 8 byte threshold had inconsistent performance. A 32 byte threshold provides the best overall balance for typical usage patterns. Anomalies may happen in a particular run of the test due to caching behavior or memory allocation.
** Key Improvements:
Threshold Analysis:
The 32-byte threshold provides optimal balance. The threshold analysis table shows performance at different thresholds, demonstrating why 32 bytes was chosen over the original 8 bytes.
Checklist