Repository navigation
🥳 added: halve TTFX of NonLinMPC and MovingHorizonEstimator constructors - #511
Conversation
…uctors I introduced a new function like wrapper, `NoTypeFunction`, to hide the concrete types of closures created for the evaluation of the objective function and its derivatives.
NonLinMPC and MovingHorizonEstimator constructorsNonLinMPC and MovingHorizonEstimator constructors
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #511 +/- ##
==========================================
+ Coverage 97.23% 97.26% +0.02%
==========================================
Files 28 28
Lines 7099 7101 +2
==========================================
+ Hits 6903 6907 +4
+ Misses 196 194 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Woaaah the precompilation time is also drastically reduced. 🥳🥳🥳 before: (TestMPC) pkg> precompile ModelPredictiveControl
Precompiling ModelPredictiveControl finished.
1 dependency successfully precompiled in 494 seconds. 113 already precompiled.after: Precompiling ModelPredictiveControl finished.
1 dependency successfully precompiled in 236 seconds. 113 already precompiled.Moreover, executing my test suite is also drastically faster. The worst test, Let's hope it does not impact the benchmarks 🤞🤞🤞 |
|
Woahhhh the CI run on GitHub is twice faster on all the legs, that's insane haha. I will try to re-enable Linux 32 bits and MacOS CI jobs in a separate PR, since the memory consumption to run the complete CI suite is significantly reduced. |
|
Alright no differences on the MHE benchmarks for runtimes, but the memory allocations at each time steps are more than twice smaller! Let's see for MPC... |
|
ALLLRIGHT similar improvement on the memory for the MPCs. The runtimes are even slighlty betters at each time steps, presumably because the number of allocations reduced. This is the perfect PR, let's merge 🍾🥳 |
I introduced a new function-like wrapper,
NoTypeFunction, that deliberately hide the very complex concrete type of the closures created for the evaluation of the objective function and its derivatives, in bothNonLinMPCandMovingHorizonEstimator. It produces a dynamic dispatch when this wrapper is called, but this is acceptable sinceMOI.jlalready does a dynamic dispatch internally when calling registered nonlinear operators.This addition approximately halves the time-for-first-execution (TTFX) of
NonLinMPCandMovingHorizonEstimatorconstruction and also reduces the allocations on this MRE:before:
after:
🍾🥳🍾🥳🍾🥳🍾🥳🍾🥳🍾🥳
Now let's see if it impacts the benchmarks...