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

Reduce cost of DAGCircuit.input_map and output_map accesses #13023

Open
jakelishman opened this issue Aug 23, 2024 · 0 comments
Open

Reduce cost of DAGCircuit.input_map and output_map accesses #13023

jakelishman opened this issue Aug 23, 2024 · 0 comments

Comments

@jakelishman
Copy link
Member

          This recreates the entire dict (which could be 100s of qubits + clbits) on every lookup.

I actually expected it to have more of an impact on transpiler performance, but it seems like we only have a couple of transpiler passes that touch them - the disjoint utils and the "remove final X" passes. I think those are sufficient non-critical we can ignore it for this first PR, but it's definitely a performance pitfall we should rectify for user passes.

Originally posted by @jakelishman in #12550 (comment)

At the moment, the Rust-space input_map and output_map properties recreate Python dictionaries on every access, meaning operations like [dag.input_map[qubit] for qubit in dag.qubits] have suddenly become quadratic in the number of qubits, rather than linear. This doesn't bite us too much in practice in the transpiler immediately, but it's absolutely a performance pitfall waiting to happen in the current structure.

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