Revert "Set sympy.evaluate(False) on frequent code paths for phase tracking. (#6072)"#6386
Conversation
…acking. (Qiskit#6072)" With recent adoption of symengine for the performance critical path with ParameterExpressions the workaround for large expression evaluation in Qiskit#6072 is no longer needed or applicable, except in environments without symengine. However, with symengine available using the sympy evaluate context adds noticeable overhead, both to import sympy (which wouldn't be used otherwise) and to load the sympy evalue context wrapper. This commit removes these as we shouldn't compromise performance in the performance path to try and speed up a path with degraded performance because symengine isn't available (32bit platforms). This reverts commit f436f5a.
|
Running the example from the original issue that #6072 was fixing with this PR returned: so using symengine alleviates the slow sympy evaluation #6072 was working around. |
|
Can #6187 likewise be reverted? |
I would expect we probably could but I wouldn't expect much of a performance change from it. I feel like a dict lookup will still be faster than symengine, but not nearly as much, but either way we'lll have to benchmark it to be sure. |
True, the benefit in that case would be mostly for code maintenance, and ease of readership. I'll check if the cache still aids performance, and remove it if not. |
Summary
With recent adoption of symengine for the performance critical path
with ParameterExpressions the workaround for large expression evaluation
in #6072 is no longer needed or applicable, except in environments
without symengine. However, with symengine available using the sympy
evaluate context adds noticeable overhead, both to import sympy (which
wouldn't be used otherwise) and to load the sympy evalue context
wrapper. This commit removes these as we shouldn't compromise performance
in the performance path to try and speed up a path with degraded
performance because symengine isn't available (32bit platforms).
Details and comments
This reverts commit f436f5a.