chore(SSA): avoid consuming self when returning Arc#10147
Conversation
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'ACVM Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.
| Benchmark suite | Current: 2ea3e90 | Previous: 845a8e4 | Ratio |
|---|---|---|---|
perfectly_parallel_batch_inversion_opcodes |
2784381 ns/iter (± 1014) |
2258668 ns/iter (± 4124) |
1.23 |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @TomAFrench
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Test Suite Duration'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.
| Benchmark suite | Current: 2ea3e90 | Previous: 845a8e4 | Ratio |
|---|---|---|---|
test_report_zkpassport_noir-ecdsa_ |
2 s |
1 s |
2 |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @TomAFrench
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Compilation Time'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.
| Benchmark suite | Current: 2ea3e90 | Previous: 845a8e4 | Ratio |
|---|---|---|---|
rollup-checkpoint-root-single-block |
300 s |
210 s |
1.43 |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @TomAFrench
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE chore: add unit tests for brillig-gen (noir-lang/noir#10130) chore(ACIR): remove non-ACIR intrinsics during simplification (noir-lang/noir#10145) fix: Do not carry over `#[fold]` to unconstrained functions during monomorphization (noir-lang/noir#10155) chore(SSA): avoid consuming self when returning Arc (noir-lang/noir#10147) fix(ssa): Use `Type::element_size` instead of `Type::flattened_size` for `optimize_length_one_array_read` (noir-lang/noir#10146) fix(ssa): SSA Interpreter handle overflow by promoting to Field (noir-lang/noir#10097) chore: Try to optimize compilation memory (noir-lang/noir#10113) chore(ACIRgen): smaller AcirDynamicArray value_types (noir-lang/noir#10128) chore(brillig_vm): Re-org integration tests and add a couple more (noir-lang/noir#10129) chore: unhide `inliner-aggressiveness` option (noir-lang/noir#10137) chore(brillig_vm): Expand arithmetic int ops tests and add field ops tests (noir-lang/noir#10101) chore(ACIR): don't override output count in black box function (noir-lang/noir#10123) chore(test): Add `interpret_execution_failure` tests (noir-lang/noir#9912) fix(ACIR): correctly display the zero expression (noir-lang/noir#10124) chore: typos and some refactors in `acvm/src/pwg/mod.rs` (noir-lang/noir#10055) chore: add brillig_call submodule (noir-lang/noir#10108) chore(ACIRgen): always compute array offset (noir-lang/noir#10099) chore: More BTreeSet avoidance (noir-lang/noir#10107) END_COMMIT_OVERRIDE Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE chore: add unit tests for brillig-gen (noir-lang/noir#10130) chore(ACIR): remove non-ACIR intrinsics during simplification (noir-lang/noir#10145) fix: Do not carry over `#[fold]` to unconstrained functions during monomorphization (noir-lang/noir#10155) chore(SSA): avoid consuming self when returning Arc (noir-lang/noir#10147) fix(ssa): Use `Type::element_size` instead of `Type::flattened_size` for `optimize_length_one_array_read` (noir-lang/noir#10146) fix(ssa): SSA Interpreter handle overflow by promoting to Field (noir-lang/noir#10097) chore: Try to optimize compilation memory (noir-lang/noir#10113) chore(ACIRgen): smaller AcirDynamicArray value_types (noir-lang/noir#10128) chore(brillig_vm): Re-org integration tests and add a couple more (noir-lang/noir#10129) chore: unhide `inliner-aggressiveness` option (noir-lang/noir#10137) chore(brillig_vm): Expand arithmetic int ops tests and add field ops tests (noir-lang/noir#10101) chore(ACIR): don't override output count in black box function (noir-lang/noir#10123) chore(test): Add `interpret_execution_failure` tests (noir-lang/noir#9912) fix(ACIR): correctly display the zero expression (noir-lang/noir#10124) chore: typos and some refactors in `acvm/src/pwg/mod.rs` (noir-lang/noir#10055) chore: add brillig_call submodule (noir-lang/noir#10108) chore(ACIRgen): always compute array offset (noir-lang/noir#10099) chore: More BTreeSet avoidance (noir-lang/noir#10107) END_COMMIT_OVERRIDE
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE chore: add unit tests for brillig-gen (noir-lang/noir#10130) chore(ACIR): remove non-ACIR intrinsics during simplification (noir-lang/noir#10145) fix: Do not carry over `#[fold]` to unconstrained functions during monomorphization (noir-lang/noir#10155) chore(SSA): avoid consuming self when returning Arc (noir-lang/noir#10147) fix(ssa): Use `Type::element_size` instead of `Type::flattened_size` for `optimize_length_one_array_read` (noir-lang/noir#10146) fix(ssa): SSA Interpreter handle overflow by promoting to Field (noir-lang/noir#10097) chore: Try to optimize compilation memory (noir-lang/noir#10113) chore(ACIRgen): smaller AcirDynamicArray value_types (noir-lang/noir#10128) chore(brillig_vm): Re-org integration tests and add a couple more (noir-lang/noir#10129) chore: unhide `inliner-aggressiveness` option (noir-lang/noir#10137) chore(brillig_vm): Expand arithmetic int ops tests and add field ops tests (noir-lang/noir#10101) chore(ACIR): don't override output count in black box function (noir-lang/noir#10123) chore(test): Add `interpret_execution_failure` tests (noir-lang/noir#9912) fix(ACIR): correctly display the zero expression (noir-lang/noir#10124) chore: typos and some refactors in `acvm/src/pwg/mod.rs` (noir-lang/noir#10055) chore: add brillig_call submodule (noir-lang/noir#10108) chore(ACIRgen): always compute array offset (noir-lang/noir#10099) chore: More BTreeSet avoidance (noir-lang/noir#10107) END_COMMIT_OVERRIDE
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE chore: add unit tests for brillig-gen (noir-lang/noir#10130) chore(ACIR): remove non-ACIR intrinsics during simplification (noir-lang/noir#10145) fix: Do not carry over `#[fold]` to unconstrained functions during monomorphization (noir-lang/noir#10155) chore(SSA): avoid consuming self when returning Arc (noir-lang/noir#10147) fix(ssa): Use `Type::element_size` instead of `Type::flattened_size` for `optimize_length_one_array_read` (noir-lang/noir#10146) fix(ssa): SSA Interpreter handle overflow by promoting to Field (noir-lang/noir#10097) chore: Try to optimize compilation memory (noir-lang/noir#10113) chore(ACIRgen): smaller AcirDynamicArray value_types (noir-lang/noir#10128) chore(brillig_vm): Re-org integration tests and add a couple more (noir-lang/noir#10129) chore: unhide `inliner-aggressiveness` option (noir-lang/noir#10137) chore(brillig_vm): Expand arithmetic int ops tests and add field ops tests (noir-lang/noir#10101) chore(ACIR): don't override output count in black box function (noir-lang/noir#10123) chore(test): Add `interpret_execution_failure` tests (noir-lang/noir#9912) fix(ACIR): correctly display the zero expression (noir-lang/noir#10124) chore: typos and some refactors in `acvm/src/pwg/mod.rs` (noir-lang/noir#10055) chore: add brillig_call submodule (noir-lang/noir#10108) chore(ACIRgen): always compute array offset (noir-lang/noir#10099) chore: More BTreeSet avoidance (noir-lang/noir#10107) END_COMMIT_OVERRIDE
Description
Problem
Just a small thing I noticed while reviewing another PR.
Summary
The method
element_typesreturnsArc. There's a comment inelement_sizethat says it's equivalent toelement_types().len()but without consumingselfso I wondered why it was consuming self. Given that the method returnsArcwe can cheaply clone a reference to Arc and return that. Then this avoids a couple of clones before calling this method. It probably doesn't have any effect on anything but now there's no need to unnecessarily consumeself.Additional Context
Documentation
Check one:
PR Checklist
cargo fmton default settings.