simpleeval
simpleeval copied to clipboard
Cache parsed expression
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.
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
Coverage increased (+0.1%) to 99.583% when pulling 71c5cc771d81e7b645c891edabc16006754870ce on Rfank2021:cache-parsed-expression into 41c99b8e224a7a0ae0ac59c773598fe79a4470db on danthedeckie:master.
Coverage decreased (-0.6%) to 98.843% when pulling 54a01a3ffda5d5a6ce8a5e8b5c3fd737d44982ac on Rfank2021:cache-parsed-expression into 41c99b8e224a7a0ae0ac59c773598fe79a4470db on danthedeckie:master.
@danthedeckie do you have time to check this? CodeFactor issues are not related to the code change.
Found a way to extend SimpleEval class, this CR is not needed.
Very much related https://github.com/danthedeckie/simpleeval/pull/60
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.