From 0e300b7b532d1796fc2dbea6f09e326b856f866a Mon Sep 17 00:00:00 2001 From: J08nY Date: Fri, 6 Oct 2023 22:45:12 +0200 Subject: Cache sympify results to speedup formula exec. --- pyecsca/misc/cache.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 pyecsca/misc/cache.py (limited to 'pyecsca/misc') diff --git a/pyecsca/misc/cache.py b/pyecsca/misc/cache.py new file mode 100644 index 0000000..385ff4b --- /dev/null +++ b/pyecsca/misc/cache.py @@ -0,0 +1,12 @@ +"""Cache some things.""" +from functools import lru_cache +from sympy import sympify as _orig_sympify +from public import public + + +@public +@lru_cache(maxsize=256, typed=True) +def sympify( + a, locals=None, convert_xor=True, strict=False, rational=False, evaluate=None +): + return _orig_sympify(a, locals, convert_xor, strict, rational, evaluate) -- cgit v1.2.3-70-g09d2