From 906cb37c79ecee9b907080f32558d5d6d5767be9 Mon Sep 17 00:00:00 2001 From: sashass1315 Date: Wed, 11 Feb 2026 00:49:04 +0200 Subject: [PATCH 1/3] perf: cache stack_size in ValueOrAlias to avoid repeated virtual dispatch --- hir/src/ir/value/aliasing.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/hir/src/ir/value/aliasing.rs b/hir/src/ir/value/aliasing.rs index 2c2a82ac2..7cae284c8 100644 --- a/hir/src/ir/value/aliasing.rs +++ b/hir/src/ir/value/aliasing.rs @@ -17,22 +17,30 @@ pub struct ValueOrAlias { /// on the operand stack as a unique value. The alias identifier is usually generated from a /// counter of the unique instances of the value, but can be any unique integer value. alias_id: u8, + /// Cached result of `value.borrow().ty().size_in_felts()`, stored to avoid repeated + /// virtual dispatch through `dyn Value` in hot loops (solver, spill analysis). + stack_size: u8, } impl ValueOrAlias { /// Create a new [ValueOrAlias] from the given [ValueRef] pub fn new(value: ValueRef) -> Self { - let value_id = value.borrow().id(); + let borrowed = value.borrow(); + let value_id = borrowed.id(); + let stack_size = borrowed.ty().size_in_felts() as u8; + drop(borrowed); Self { value, value_id, + stack_size, alias_id: 0, } } /// Gets the effective size of this type on the Miden operand stack + #[inline(always)] pub fn stack_size(&self) -> usize { - self.value.borrow().ty().size_in_felts() + self.stack_size as usize } /// Create an aliased copy of this value, using `id` to uniquely identify the alias. From f9e7cde2b4ba9d91656eaee5d8e20532cbe12323 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Wed, 11 Feb 2026 18:02:28 +0200 Subject: [PATCH 2/3] chore: run gh runner image cleanup in release jobs --- .github/workflows/release.yml | 3 +++ .github/workflows/release_old.yml | 1 + 2 files changed, 4 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4deeb91b3..f4b35748c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,6 +25,7 @@ jobs: releases: ${{ steps.publish.outputs.releases }} releases_created: ${{ steps.publish.outputs.releases_created }} steps: + - uses: ./.github/actions/cleanup-runner - &checkout uses: actions/checkout@v5 with: @@ -63,6 +64,7 @@ jobs: target: aarch64-apple-darwin runs-on: ${{ matrix.os }} steps: + - uses: ./.github/actions/cleanup-runner - *checkout - *install-rust - name: Determine midenc release tag @@ -137,6 +139,7 @@ jobs: group: release-plz-${{ github.ref }} cancel-in-progress: false steps: + - uses: ./.github/actions/cleanup-runner - *checkout - *install-rust - name: Create release PR diff --git a/.github/workflows/release_old.yml b/.github/workflows/release_old.yml index 36fc3852d..5fcb848ac 100644 --- a/.github/workflows/release_old.yml +++ b/.github/workflows/release_old.yml @@ -21,6 +21,7 @@ jobs: permissions: contents: read steps: + - uses: ./.github/actions/cleanup-runner - uses: actions/checkout@v5 - name: Install Rust run: | From 6a41275f0974315077e4e8fd91c72102a2a96dcd Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Wed, 11 Feb 2026 18:24:38 +0200 Subject: [PATCH 3/3] chore: fix the order, call `cleanup-runner` after the checkout --- .github/workflows/release.yml | 6 +++--- .github/workflows/release_old.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f4b35748c..48e136132 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,12 +25,12 @@ jobs: releases: ${{ steps.publish.outputs.releases }} releases_created: ${{ steps.publish.outputs.releases_created }} steps: - - uses: ./.github/actions/cleanup-runner - &checkout uses: actions/checkout@v5 with: fetch-depth: 0 persist-credentials: false + - uses: ./.github/actions/cleanup-runner - &install-rust name: Install Rust run: | @@ -64,8 +64,8 @@ jobs: target: aarch64-apple-darwin runs-on: ${{ matrix.os }} steps: - - uses: ./.github/actions/cleanup-runner - *checkout + - uses: ./.github/actions/cleanup-runner - *install-rust - name: Determine midenc release tag id: midenc-release @@ -139,8 +139,8 @@ jobs: group: release-plz-${{ github.ref }} cancel-in-progress: false steps: - - uses: ./.github/actions/cleanup-runner - *checkout + - uses: ./.github/actions/cleanup-runner - *install-rust - name: Create release PR id: release-pr diff --git a/.github/workflows/release_old.yml b/.github/workflows/release_old.yml index 5fcb848ac..5a11b2e59 100644 --- a/.github/workflows/release_old.yml +++ b/.github/workflows/release_old.yml @@ -21,8 +21,8 @@ jobs: permissions: contents: read steps: - - uses: ./.github/actions/cleanup-runner - uses: actions/checkout@v5 + - uses: ./.github/actions/cleanup-runner - name: Install Rust run: | rustup update --no-self-update