takes about 2 seconds on a 2.6ghz mac i7, and then doing maths on x is practically instant.
However:
then takes over a minute...
I think that the numerical operations are all actually really fast. It still makes sense to have limits in place for them - but much higher limits, probably.
However, converting them to strings (even just printing the number to stdout means converting to string first) is ... a lot slower.
With that in mind - how could we revisit the safety limits in simpleeval?
an option:
One thing that may help would be looking at gmpy2 as an option for maths in general - but turning numbers into strings in particular. Weirdly:
from gmpy2 import mpz
print(str(mpz(x)))
is almost instant too...
Even if we don't want to include gmpy2 as a dependency of simpleeval (certainly not happening before the 2.x branching...) then at least having some kind of mentioning & examples in the docs could be really useful.
takes about 2 seconds on a 2.6ghz mac i7, and then doing maths on
xis practically instant.However:
then takes over a minute...
I think that the numerical operations are all actually really fast. It still makes sense to have limits in place for them - but much higher limits, probably.
However, converting them to strings (even just printing the number to stdout means converting to string first) is ... a lot slower.
With that in mind - how could we revisit the safety limits in simpleeval?
an option:
One thing that may help would be looking at gmpy2 as an option for maths in general - but turning numbers into strings in particular. Weirdly:
is almost instant too...
Even if we don't want to include gmpy2 as a dependency of simpleeval (certainly not happening before the 2.x branching...) then at least having some kind of mentioning & examples in the docs could be really useful.