JuliaManifolds / Manopt.jl

🏔️Manopt. jl – Optimization on Manifolds in Julia
http://manoptjl.org
Other
314 stars 40 forks source link

Improve performance of IPM #404

Closed mateuszbaran closed 1 month ago

mateuszbaran commented 1 month ago

This significantly improves performance of interior point Newton method. Together with some light improvements to ManifoldsBase, I got from 9ms to below 3ms on the problem from the test suite. The two biggest issues were:

  1. Accessing product manifold components like Y[N, 1] is really slow. I recommend using things like Y1, Y2 = submanifold_components(N, Y) in performance-sensitive code. Maybe it would be possible to speed up Y[N, 1] but it would require tinkering with compiler heuristics which is quite difficult and depends on the version of Julia.
  2. Broadcasting. It can eliminate vast majority of intermediate arrays.

Not that many potential gains remain as those 3ms are dominated by calls to Hessian and gradient of g.

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 99.78%. Comparing base (0b05c8c) to head (2705059).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #404 +/- ## ======================================= Coverage 99.78% 99.78% ======================================= Files 76 76 Lines 8217 8226 +9 ======================================= + Hits 8199 8208 +9 Misses 18 18 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

kellertuer commented 1 month ago

I was not aware of the first. For the second I was maybe more focused on the math being correct. Thanks for fixing this :)