lmfit / asteval

minimalistic evaluator of python expression using ast module
https://lmfit.github.io/asteval
MIT License
176 stars 41 forks source link

Performance of Interpreter construction #104

Closed eendebakpt closed 2 years ago

eendebakpt commented 2 years ago

The Interpreter is constructed many times when fitting with lmfit. This PR improves performance by

Current master branch:

%timeit Interpreter()
364 µs ± 21.4 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)

With this PR

%timeit Interpreter()
271 µs ± 23.7 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)

@newville

newville commented 2 years ago

@eendebakpt thanks! I'll merge this