python - Poor sympy performance -


I use Python 3.4.2 on Windows 8.1 (x64) using Simply 0.7.5 (via PIP) I am here. Please consider this short program:

  Import for import sympy import time = time.time () in category (100): sympy.Point (12345.0, 54321.0) print (' Passed (ms): ', (time. Time () - start) * 1000)   

This takes about my machine 22 seconds to execute. What am I missing here?

Simply By making the point s temporary, the point numbers are automatically converted into a rational number. This can be a good thing (eg if you want to avoid the exact loss of floating point), but may be very slow ( lot ) rational s pass To disable conversion on Evaluation = False , for example

 % timeit sympy.Point (12345., 54321.) 10 loops, best 3: 31.8 MS per-loop% timeit sympy.point (12345., 54321., evaluation = false) 10000 loops, the best 3: 22.3 per loop per    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -