High-precision can be faster by replacing ToFromPythonConverter.hpp with a visitor
I have realized that high precision calculations can be made faster by replacing ToFromPythonConverter.hpp with a visitor, like here it is done for matrices and vectors.
The problem is with string streaming. When implementing high precision in YADE I was thinking that this string streaming happens only at beginning of simulation when reading parameters. But a detailed benchmark shows that string streaming from mpmath
python high precision package occurs quite frequently.
To be more precise in a test yade -n --quickperformance
the pow(…,…)
function was called 448926 times and yade::math::fromStringRealHP(…)
was called 233478 times. But these string conversions can be completely eliminated. This will be a complete rewrite of ToFromPythonConverter.hpp into a new visitor code, so it may take some time. But it's good that we found out about this. Also it is very good that we have a wide CI test coverage, so it will be much easier to test the new implementation.
This might take some time to do.