-
Notifications
You must be signed in to change notification settings - Fork 219
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
Acir Opcode count less with additional print statement after unused variable #6432
Labels
bug
Something isn't working
Comments
This is shown by the program fn main(input: str<U>, base64_encoded: str<B>) {
let _encoded: [u8; B] = BASE64_ENCODER.encode(input.as_bytes());
println(_encoded);
} Without the print we get
and with the print we get
|
Cleaner repro
use base64::BASE64_ENCODER;
fn main(input: str<1>) {
let _encoded: [u8; 4] = BASE64_ENCODER.encode(input.as_bytes());
println(_encoded);
} |
@guipublic can you take a look at this when you've got some bandwidth? I'm guessing this is due to unused array gets being replaced with explicit bounds checks? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Aim
Measure gates of a lib's use, so need to understand when an unused variable is optimised out of a program (or not) for realistic benchmarks.
Expected Behavior
Adding a
println
after an unused variable should not have less acir opcodes.Bug
Program (with unused variable) has:
"acir_opcodes": 410,
Program where unused variable is followed by printing it:
"acir_opcodes": 334,
To Reproduce
jz/base64_example
cd lib_examples/base64_example
nargo e -p Prover_SHORT.toml base64_example_SHORT
bb gates -b ../target/base64_example.json -w ../target/base64_example_SHORT
, (Note acir_opcodes)_encoded
variable line (here), addprintln(_encoded);
Workaround
None
Workaround Description
No response
Additional Context
Related to noir-lang/noir-examples#28
Project Impact
None
Blocker Context
No response
Nargo Version
noirc version = 0.36.0+801c71880ecf8386a26737a5d8bb5b4cb164b2ab
NoirJS Version
No response
Proving Backend Tooling & Version
Barretenberg - bb CLI - 0.58.0%
Would you like to submit a PR for this Issue?
None
Support Needs
No response
The text was updated successfully, but these errors were encountered: