Skip to content
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

Nargo further optimizes cached programs after loading them. #6667

Closed
TomAFrench opened this issue Dec 2, 2024 · 0 comments
Closed

Nargo further optimizes cached programs after loading them. #6667

TomAFrench opened this issue Dec 2, 2024 · 0 comments

Comments

@TomAFrench
Copy link
Member

TomAFrench commented Dec 2, 2024

In this snippet we're either compiling the program from scratch or returning a cached artifact. This will then be unconditionally fed into nargo::ops::transform.

let compile_package = |package| {
let (program, warnings) = compile_program(
file_manager,
parsed_files,
workspace,
package,
compile_options,
load_cached_program(package),
)?;
let target_width =
get_target_width(package.expression_width, compile_options.expression_width);
let program = nargo::ops::transform_program(program, target_width);
nargo::ops::check_program(&program)?;
save_program_to_file(&program.into(), &package.name, workspace.target_directory_path());
Ok(((), warnings))
};

This is fine when nargo::ops::transform is a noop on a cached artifact but it seems that MergeOptimizer is not fully optimizing programs on the first instance so when we run the cached program through it again it can further optimize the program resulting in a different bytecode being executed compared to what's saved on disk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

1 participant