You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix performance regression in UnitarySynthesis (#13375)
* Fix performance regression in UnitarySynthesis
This commit fixes a performance regression that was introduced in
PR #13141. When the pass is looking up the preferred synthesis direction
for a unitary based on the connectvity constraints the connectivity was
being provided as a PyList. To look up the edge in connectivity set this
meant we needed to iterate over the list and then create a set that rust
could lookup if it contains an edge or it's reverse. This has
significant overhead because its iterating via python and also iterating
per decomposition. This commit addresses this by changing the input type
to be a HashSet from Python so Pyo3 will convert a pyset directly to a
HashSet once at call time and that's used by reference for lookups
directly instead of needing to iterate over the list each time.
* Avoid constructing plugin data views with default plugin
If we're using the default plugin the execution will happen in rust
and we don't need to build the plugin data views that are defined in the
plugin interface. Profiling the benchpress test using the hamlib
hamiltonian:
ham_graph-2D-grid-nonpbc-qubitnodes_Lx-5_Ly-186_h-0.5-all-to-all
that caught this originally regression was showing an inordinate amount
of time being spent in the construction of
`_build_gate_lengths_by_qubit` and `_build_gate_errors_by_qubit` which
isn't being used because this happens internally in rust now. To
mitigate this overhead this commit migrates the sections computing these
values to the code branch that uses them and not the default plugin
branch that uses rust.
0 commit comments