Problem: The formula based dispersions are extremely slow compared to the predefined model (1.2 it/s compared to 200 it/s for the Solver2x2 and 1 it/s compared to 6 it/s for Solver4x4expm).
Solution: This is likely due to the fact that I re-parse the formula all the time. There are several ways to tackle this, which eventually could all be incorporated:
Generate a standalone parser with lark. Through hard-coding I expect this to be a bit faster
Cache the formula and only adjust the parameters. This is currently not possible in a straight-forwardly fashion, because the transformer class has to be re-build and re-attached. We could parse the formula and just attach a new transformer and use caching in the class for the parsing object.
Write the parsing in Rust. I already have a half-backed implementation ready and we would need to interface this with python. This would be more complex but it's a nice project :) It would, however, complicate the package distribution as Rust part needs to be rebuild (Edit: While testing with maturin I found that they supply a CI/CD to build wheels for every main architecture. So this is not an issue).
I'm testing building a distinct package with a rust-based formula dispersion here
The idea is to first leave this as a separate package and add it via an option in pyElli (or if it works well replace the formula dispersion entirely).
Problem: The formula based dispersions are extremely slow compared to the predefined model (1.2 it/s compared to 200 it/s for the Solver2x2 and 1 it/s compared to 6 it/s for Solver4x4expm).
Solution: This is likely due to the fact that I re-parse the formula all the time. There are several ways to tackle this, which eventually could all be incorporated: