Skip to content

chore(SSA): avoid consuming self when returning Arc#10147

Merged
TomAFrench merged 2 commits intomasterfrom
ab/type-element_types-avoid-clone
Oct 10, 2025
Merged

chore(SSA): avoid consuming self when returning Arc#10147
TomAFrench merged 2 commits intomasterfrom
ab/type-element_types-avoid-clone

Conversation

@asterite
Copy link
Collaborator

@asterite asterite commented Oct 9, 2025

Description

Problem

Just a small thing I noticed while reviewing another PR.

Summary

The method element_types returns Arc. There's a comment in element_size that says it's equivalent to element_types().len() but without consuming self so I wondered why it was consuming self. Given that the method returns Arc we 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 consume self.

Additional Context

Documentation

Check one:

  • No documentation needed.
  • Documentation included in this PR.
  • [For Experimental Features] Documentation to be submitted in a separate PR.

PR Checklist

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt on default settings.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ 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

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ 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

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ 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

@TomAFrench TomAFrench added this pull request to the merge queue Oct 10, 2025
Merged via the queue into master with commit cedc8ec Oct 10, 2025
179 of 182 checks passed
@TomAFrench TomAFrench deleted the ab/type-element_types-avoid-clone branch October 10, 2025 12:54
AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Oct 13, 2025
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>
AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Oct 13, 2025
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
github-merge-queue bot pushed a commit to AztecProtocol/aztec-packages that referenced this pull request Oct 13, 2025
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
github-merge-queue bot pushed a commit to AztecProtocol/aztec-packages that referenced this pull request Oct 13, 2025
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants