simpleeval icon indicating copy to clipboard operation
simpleeval copied to clipboard

Cache parsed expression

Open Rfank2021 opened this issue 3 years ago • 6 comments

We tested that cache ast parsing result reduced more than 50% run time for our user case, it would be great if it can be merged.

The cache is an option which is disabled by default, so current user will not be affected.

Rfank2021 avatar Apr 06 '21 07:04 Rfank2021

Hello @Rfank2021! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers:

Comment last updated at 2021-04-06 07:49:35 UTC

pep8speaks avatar Apr 06 '21 07:04 pep8speaks

Coverage Status

Coverage increased (+0.1%) to 99.583% when pulling 71c5cc771d81e7b645c891edabc16006754870ce on Rfank2021:cache-parsed-expression into 41c99b8e224a7a0ae0ac59c773598fe79a4470db on danthedeckie:master.

coveralls avatar Apr 06 '21 07:04 coveralls

Coverage Status

Coverage decreased (-0.6%) to 98.843% when pulling 54a01a3ffda5d5a6ce8a5e8b5c3fd737d44982ac on Rfank2021:cache-parsed-expression into 41c99b8e224a7a0ae0ac59c773598fe79a4470db on danthedeckie:master.

coveralls avatar Apr 06 '21 07:04 coveralls

@danthedeckie do you have time to check this? CodeFactor issues are not related to the code change.

Rfank2021 avatar Apr 06 '21 08:04 Rfank2021

Found a way to extend SimpleEval class, this CR is not needed.

Rfank2021 avatar Apr 08 '21 08:04 Rfank2021

Very much related https://github.com/danthedeckie/simpleeval/pull/60

n1ngu avatar Sep 20 '21 11:09 n1ngu

I'm closing this PR, as 0.9.13 now includes a separated parse and eval methods, which allows you cache the parsed AST tree outside of SimpleEval pretty easily.

danthedeckie avatar Feb 17 '23 09:02 danthedeckie