-
Notifications
You must be signed in to change notification settings - Fork 84
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
Create hashes using string builder instead of big integers #22
Comments
for smaller than 64 bit hashes we could also fall back to long variables and do primitive bit shifting. |
jmh benchmarks.
Mutable big integer requires method handles and reflection access which is not warranted for the performance difference compare to the stringbuilder approach (as well as unit tests to guarantee that the implementation is working as expected). A new StringBuilder is created for every hash creation. Caching a stringbuilder would result again in a performance gain at the cost of thread safety. In relation file IO is much more heavy and the treadoff isn't worth it. Migration to either stringbuilder or mutable big int allows to cut the first pass needed to estimate the hash length on an algorithm basis |
fixed with afc026d |
Using a custom hash builder which manipulates a byte array directly we can gain even more performance d9ef1f8 |
fixed with v 3.0.0 |
During hash creation a bigInteger object will be created for each bit present. Currently no fancy operation take place during it's creation process that justify this overhead.
Afterwards the xor operation on arbitrary hashes is required for the hamming distance calculation.
Benchmark if it's more performant to use a stringbuilder.
vs new
In cooperation with #18
The text was updated successfully, but these errors were encountered: