Skip to content

refactor(forge): avoid unnecessary gas_snapshots clones in test runner#13969

Open
ArshLabs wants to merge 1 commit intofoundry-rs:masterfrom
ArshLabs:refactor/remove-gas-snapshots-unnecessary-clones
Open

refactor(forge): avoid unnecessary gas_snapshots clones in test runner#13969
ArshLabs wants to merge 1 commit intofoundry-rs:masterfrom
ArshLabs:refactor/remove-gas-snapshots-unnecessary-clones

Conversation

@ArshLabs
Copy link
Copy Markdown

@ArshLabs ArshLabs commented Mar 27, 2026

Motivation

run_tests_inner() iterates gas_snapshots (a BTreeMap<String, BTreeMap<String, String>>) twice, once for snapshot checking and once for emitting, using .clone().into_iter() each time. The map is accumulated across the per-suite loop and must survive each iteration, so ownership can't be taken. Neither path needs it.

Solution

Switches both to .iter(), dropping two unnecessary deep copies per test contract.

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant