-
Notifications
You must be signed in to change notification settings - Fork 204
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
chore: remove temporary allocations from num_bits
#6600
Conversation
Incredible! On Friday I was looking at small and quick optimization opportunities and found a couple of them, one of them was this one (not with this algorithm, but I noticed Another thing I found is that Another one I found was this double hashmap lookup: noir/acvm-repo/acvm/src/compiler/transformers/csat.rs Lines 274 to 275 in 7311d8c
but I didn't send any PR because I wasn't sure if any of those improved the performance, really. |
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.
Looks good! I left a comment for something that might require an additional test.
I can't see any meaningful benefit for this and it'll remove an allocation so let's do it. |
We end up hitting our peak memory usage during SSA rather than in the post-compilation transformations so I think we can ignore this for now. |
Description
Problem*
Closes #4759
Summary*
I found this due to #6550.
We make heavy use of the
num_bits
method during compilation but this is currently doing a lot of unnecessary allocations in order to perform a full bit decomposition of the field element. We can rework this to work on the byte decomposition which removes 96% of all the temporary allocations from compilation.Additional Context
Documentation*
Check one:
PR Checklist*
cargo fmt
on default settings.