-
Notifications
You must be signed in to change notification settings - Fork 996
Use rust builtins for round_upto_multiple_of_64 and ceil #7358
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
Conversation
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.
Thanks @psvri - I think we should run some benchmarks to ensure we aren't introducing some performance regressions by accident
To investigate pub fn shrink_to_fit(&mut self) {
let new_capacity = bit_util::round_upto_multiple_of_64(self.len);
if new_capacity < self.layout.size() {
self.reallocate(new_capacity)
}
} ...from a release build for main and this PR: The generated instructions are slightly different, but general number of instructions, look the same. I would be stunned if you measured anything other than noise in a release build. I'll take a look at |
For /// creates a new [MutableBuffer] with capacity and length capable of holding `len` bits.
/// This is useful to create a buffer for packed bitmaps.
pub fn new_null(len: usize) -> Self {
let num_bytes = bit_util::ceil(len, 8);
MutableBuffer::from_len_zeroed(num_bytes)
} |
For |
So, almost the entire codebase uses compile time constant args that are powers of two to Darn. Aside from label names, they're exactly the same. I really thought I'd find a difference. Long way of saying, there should not be measurable performance difference on this PR. |
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.
Thank you @mbutrovich and @psvri for your contribution and analysis
🚀 ! |
Which issue does this PR close?
Closes #.
Rationale for this change
Now that we have updated msrv, we can use rust built ins for round_upto_multiple_of_64 and div_ceil
What changes are included in this PR?
Are there any user-facing changes?
Yes, minor edits to error message