Possible slowdown in Extrema_ExtPC and Extrema_LocateExtPC


While profiling the face sewing algorithm in our application - just four cases -, I noticed that in three of them almost 10% of the time was spent in the functions Extrema_...::SearchOfTolerance (several instances of the same generic code).
These function was introduced just recently (we got it when updating from 6.6.0 to 7.3.0).
11 derivatives are computed at every initialization of the function for Newton algorithm, to compute a tolerance which is seldom needed.
In the attached file (Extrema_FuncExtPC.gxx) I have fixed it in some way but I hope you can do better.
Just search for "// change by Open Mind (Mauro)"
The idea is to compute the tolerance only when a derivative is actually found to be rather small and then check with the correct tolerance.
Thanks for reading.
Mauro Mariotti.
Open Mind Technologies

Kirill Gavrilov's picture

> These function was introduced just recently
Well, this actually happened a while ago - 6 years passed ;):

Mikhail Sazonov's picture

Dear Mauro,

Could you register a bug in the tracker? And you can create a new branch with suggested patch for review and certification.

Best regards,