-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fix performance regression in circuit_to_instruction #13942
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
Conversation
In Qiskit#13921 a check was added to circuit_to_instruction() for determining if the circuit has a control flow op. This check was adding significant overhead to the function, nightly asv benchmarks are showing up to a ~9x slowdown. Qiskit#13921 attempted to fix this regression but did so by adding a new API which isn't applicable at this point for 2.0. That PR could/should still be used in 2.1. In the meantime this commit seeks to solve the performance regression by adjusting how the check is performed to mitigate the runtime regression for 2.0.
One or more of the following people are relevant to this code:
|
I ran some benchmarks locally on my laptop to test the performance improvement here:
I did try using |
Pull Request Test Coverage Report for Build 13610021201Details
💛 - Coveralls |
How does the performance compare to before the original PR? |
There's still a regression, but it's less severe:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks - it's not ideal, but a better situation than before.
Summary
In #13921 a check was added to circuit_to_instruction() for determining if the circuit has a control flow op. This check was adding significant overhead to the function, nightly asv benchmarks are showing up to a ~9x slowdown. #13921 attempted to fix this regression but did so by adding a new API which isn't applicable at this point for 2.0. That PR could/should still be used in 2.1. In the meantime this commit seeks to solve the performance regression by adjusting how the check is performed to mitigate the runtime regression for 2.0.
Details and comments