python - Poor sympy performance -
i'm using sympy 0.7.5 (installed via pip) python 3.4.2 on windows 8.1 (x64). please consider short program:
import sympy import time start = time.time() in range(100): sympy.point(12345.0, 54321.0) print('elapsed (ms):', (time.time() - start) * 1000)
it takes machine 22 seconds execute this. missing here?
when generating sympy.point
s floating point numbers automatically converted rational numbers. can thing (e.g. if avoid floating point precision loss), can (very) slow. disable conversion rational
s pass evaluate=false
, e.g.
%timeit sympy.point(12345., 54321.) 10 loops, best of 3: 31.8 ms per loop %timeit sympy.point(12345., 54321., evaluate = false) 10000 loops, best of 3: 22.3 per loop
python floating-point sympy
No comments:
Post a Comment