Skip to content

Create a MomentBuilder for faster building of circuits. #5331

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

Closed
wants to merge 2 commits into from

Conversation

daxfohl
Copy link
Collaborator

@daxfohl daxfohl commented May 5, 2022

This is a completely hacky but short and effective way of speeding up large circuit creation by 30x. I'm open to ideas on how to make this less hacky before merging. Or maybe it's good enough.

@daxfohl daxfohl requested review from a team, vtomole and cduck as code owners May 5, 2022 00:00
@daxfohl daxfohl requested a review from maffoo May 5, 2022 00:00
@CirqBot CirqBot added the size: M 50< lines changed <250 label May 5, 2022
@daxfohl
Copy link
Collaborator Author

daxfohl commented May 5, 2022

Actually this may kind of be crap. Alternatively when building a circuit with EARLIEST strategy, we can have a specialized method that keeps a dictionary of qubits, mkeys, and ckeys to the last moment index that contains them. Then instead of having to start at the end and check each moment, you can look up the correct moment in constant time. That would probably be a bit faster than this in most cases, and way faster if you have a long circuit and are building it qubit-by-qubit.

@daxfohl daxfohl closed this May 5, 2022
@daxfohl daxfohl deleted the builder branch May 5, 2022 04:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: M 50< lines changed <250
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants