Skip to content

We need to revisit performance limits #122

Description

@danthedeckie
x = 100000 ** 100000

takes about 2 seconds on a 2.6ghz mac i7, and then doing maths on x is practically instant.

However:

print(x)

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions