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
Improvement in performance of resolve_parameters #6128
Improvement in performance of resolve_parameters #6128
Conversation
Can you post results from running the before/after benchmarks from the original issue and also from https://github.com/quantumlib/Cirq/blob/master/benchmarks/parameter_resolution.py ? |
Can you also run the asv benchmark https://github.com/quantumlib/Cirq/blob/master/benchmarks/parameter_resolution.py ? |
Yes, I will. I'm a bit busy today and tomorrow but will do on sunday. |
@skushnir123 We can keep the PR open? |
I ran the benchmarks and it mostly looks good. I also think the parameter resolution benchmark should be probably be rewritten because there's a lot of time that goes in Circuit construction. Either way, this PR is good to merge. Thanks for the fix @skushnir123 !
|
This PR is in response to #6091 where it was brought up that cirq.resolve_parameters is very slow. This one-line PR speeds up the performance of the problem mentioned in the issue by a factor of ~6x (at least on my computer) and is comparable with qiskit's bind_parameters. The issue I found was that Sympy's subs function was being run on Floats which didn't do anything but took up the majority of the running time.
Before my change:
After my change:
Note: difference of ~6x