Skip to content

fix: check values.contains_key before get_type_info#9703

Open
Bashmunta wants to merge 1 commit intostarkware-libs:mainfrom
Bashmunta:fix/circuit-info-check-before-lookup
Open

fix: check values.contains_key before get_type_info#9703
Bashmunta wants to merge 1 commit intostarkware-libs:mainfrom
Bashmunta:fix/circuit-info-check-before-lookup

Conversation

@Bashmunta
Copy link
Copy Markdown
Contributor

@Bashmunta Bashmunta commented Feb 20, 2026

Summary

Moved the values.contains_key() check before get_type_info() call to avoid redundant lookups, matching the pattern used in parse_circuit_inputs.


Type of change

Please check one:

  • Performance improvement

Why is this change needed?

In get_circuit_info, context.get_type_info() was called before checking if the value was already processed. Since the same gate can appear multiple times in the stack (shared inputs), this caused unnecessary lookups when the value already existed in values.

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@reviewable-StarkWare
Copy link
Copy Markdown

This change is Reviewable

Copy link
Copy Markdown
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

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

@orizi made 1 comment.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on Bashmunta).


crates/cairo-lang-sierra/src/extensions/modules/circuit.rs line 1069 at r1 (raw file):

        if values.contains_key(&ty) {
            // The value was already processed.

why remove the doc?

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.

3 participants