chore: add fast crc32c concat implementation#3148
Merged
BenWhitehead merged 1 commit intomainfrom Jun 24, 2025
Merged
Conversation
This new implementation provides a constant time computation regardless of the length of B, rather than the previous implementation which took linear time relative to the length of B. #### Benchmark summary CPU: AMD Ryzen Threadripper PRO 3945WX 12-Cores OS: Debian Testing ``` # JMH version: 1.37 # VM version: JDK 11.0.17, OpenJDK 64-Bit Server VM, 11.0.17+8 # VM invoker: /home/benwhitehead/opt/java/jdk-11.0.17+8/bin/java # VM options: -Xms1g -Xmx1g -XX:+AlwaysPreTouch # Blackhole mode: full + dont-inline hint (auto-detected, use -Djmh.blackhole.autoDetect=false to disable) # Warmup: 4 iterations, 30 s each # Measurement: 8 iterations, 30 s each # Timeout: 10 min per iteration # Threads: 1 thread, will synchronize iterations # Benchmark mode: Sampling time ``` ``` Benchmark (objectSize) Mode Cnt Score Error Units Crc32cBenchmark.concatCrc32c 131072 sample 9243752 0.074 ± 0.001 us/op Crc32cBenchmark.concatCrc32c 262144 sample 9015106 0.078 ± 0.001 us/op Crc32cBenchmark.concatCrc32c 524288 sample 9010257 0.074 ± 0.001 us/op Crc32cBenchmark.concatCrc32c 1048576 sample 9165519 0.074 ± 0.001 us/op Crc32cBenchmark.concatCrc32c 2097152 sample 8993038 0.075 ± 0.001 us/op Crc32cBenchmark.crc32cCombineGoogle 131072 sample 2070639 115.806 ± 0.018 us/op Crc32cBenchmark.crc32cCombineGoogle 262144 sample 1029209 233.019 ± 0.045 us/op Crc32cBenchmark.crc32cCombineGoogle 524288 sample 516517 464.360 ± 0.106 us/op Crc32cBenchmark.crc32cCombineGoogle 1048576 sample 262118 915.067 ± 0.354 us/op Crc32cBenchmark.crc32cCombineGoogle 2097152 sample 131385 1825.685 ± 0.834 us/op ```
BrandonY
approved these changes
Jun 13, 2025
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.
This new implementation provides a constant time computation regardless of the length of B, rather than the previous implementation which took linear time relative to the length of B.
Benchmark summary
CPU: AMD Ryzen Threadripper PRO 3945WX 12-Cores
OS: Debian Testing