[Performance] Bernstein evaluation actually seems faster than horner's algorithm
Created by: stonneau
Considering the test for BezierCurveTestCompareHornerAndBernstein:
First, it appears that the switch case for analytical evaluation of lower degrees Bezier curve makes things slower in average, so we should just remove them.
Secondly, while the current operator() uses horner's algorithm to evaluate the value of the curve at a given point, it seems that the Bernstein implementation is actually faster (tested on 2 different computers). Even when reverting to the commit where I claimed that Horner's was 100 times faster than the Bernstein evaluation... https://github.com/humanoid-path-planner/hpp-spline/commit/1a6ef241f51b13d96ea114defe238e8dbf126c60
@pFernbach , can you confirm that you obtain the same results (for both cases) on your machine ? If this is the case, then we should switch back to Bernstein evaluation.
Here is my output for the older version:
performing tests... time for analytical eval 0.151489 time for bernstein eval 0.126431 time for horner eval 0.149217 now with high order polynom time for analytical eval 0.494174 time for bernstein eval 0.343853 time for horner eval 0.494108 no errors found
and for the new one: time for analytical eval 0.170558 time for bernstein eval 0.129781 time for horner eval 0.14481 time for deCasteljau eval 0.383445 now with high order polynom time for analytical eval 0.524205 time for bernstein eval 0.349588 time for horner eval 0.486042 time for deCasteljau eval 4.19729