-
Notifications
You must be signed in to change notification settings - Fork 196
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
feat(perf): Simplify array get when most recent array set writes to the same index #6220
base: master
Are you sure you want to change the base?
Conversation
Changes to Brillig bytecode sizes
🧾 Summary (10% most significant diffs)
Full diff report 👇
|
Changes to circuit sizes
🧾 Summary (10% most significant diffs)
Full diff report 👇
|
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.
I don't think this takes into account enable_side_effects
. Can you add a test for this?
fn main(v1: [Field; 3], v2: u32) {
enable_side_effects u1 0
v4 = array_set v1, index v2, value v3
enable_side_effects u1 1
v5 = array_get v4, index v2
return v5
}
Ah yes good catch. I'm not sure if we can have this optimization here then as we need more information than just the array instructions. Going to convert this back to a draft for now. |
Description
Problem*
Part of general effort to reduce Brillig bytecode sizes
Summary*
This takes inspiration from #6207 that the value is still known at a previous array set when the index is dynamic.
Additional Context
Documentation*
Check one:
PR Checklist*
cargo fmt
on default settings.