-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Speed up NumericUtils#{subtract,add} #15303
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
base: main
Are you sure you want to change the base?
Conversation
Also add benchmarks to test both
This PR does not have an entry in lucene/CHANGES.txt. Consider adding one. If the PR doesn't need a changelog entry, then add the skip-changelog label to it and you will stop receiving this reminder on future updates to the PR. |
JMH benchmarks show ~75% speedup in individual operations:
|
I'm not 100% sure on what's considered a "normal" |
I ran the
|
borrow = 0; | ||
} | ||
|
||
BitUtil.VH_BE_INT.set(result, i - start, (int) diff); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BitUtil.VH_BE_INT
will need to be un-deprecated if we go ahead with this?
Description
NumericUtils#subtract
andNumericUtils#add
perform their respective operations on two byte arrays (treating them as large unsigned numbers) and store the result in another byte array.These are performed byte-by-byte, can we speed them up by operating on integers?