Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

We need to revisit performance limits #122

Open
danthedeckie opened this issue Feb 8, 2023 · 0 comments
Open

We need to revisit performance limits #122

danthedeckie opened this issue Feb 8, 2023 · 0 comments
Labels
Milestone

Comments

@danthedeckie
Copy link
Owner

danthedeckie commented Feb 8, 2023

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.

@danthedeckie danthedeckie added this to the 2.0-alpha milestone Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant