Closed JoergAtGithub closed 2 months ago
As alternative the rolling mean implementation of the boost library could be used: https://www.boost.org/doc/libs/1_85_0/boost/accumulators/statistics/rolling_mean.hpp
Thank you for the proposal - you're right that quite a lot of time is spent here. However I don't think a change like this would be a good idea unless profiling showed it to be consistently faster. I appreciate that it makes the code shorter as well, but it replaces a fairly well optimised path that has predictable performance with a standard library container whose performance is a relative unknown and that may involve heap allocation.
I may revisit the question of median filters at some point, but it's very sensitive to code generation and details of measurement.
(We don't use Boost in this library - only for the unit tests. But in any case that is a moving mean, not the moving median we need.)
I noticed that significiant CPU time is burned for calculating the MovingMean. This PR is contains an alternative implementation based on std functions. In my setup the profiler results were sometimes better and sometimes worse.