Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Programs should store DEFCIRCUITs in a map like other "DEF" instructions #389

Open
MarquessV opened this issue Aug 15, 2024 · 1 comment

Comments

@MarquessV
Copy link
Contributor

Currently, DEFCIRCUIT is classified as part of a Program's "body instructions" whereas all other "DEF" instructions are stored in their own mapping.

Since body instructions are stored in a Vec, it's not possible to find a DEFCIRCUIT in a program without doing a O(n) search through the body_instructions vector. DEFCIRCUITs are often re-used in multiple programs, and storing them in a map would allow them to be accessed more efficiently.

From a UX perspective, it is also confusing that all DEF instructions except for DEFCIRCUIT get hoisted to the top of the program.

@MarquessV
Copy link
Contributor Author

cc: @mhodson-rigetti @bramathon

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

No branches or pull requests

1 participant