Dear Johan,
Sorry, I can not follow how you get "for the first run, you have 1s per ipopt call, and for the second 0.4s".
According to your comment, the only reasonable number to report is the time spent in the solver (ipopt), then
for 2 time steps simulation, total time for "ipopt" is 0.9s, therefore, 0.45s per ipopt call
for 25 time steps simulation, total time for "ipopt" is 10.994, therefore, 0.43976s per ipopt call
In summary, to make sure I understand this, you are suggesting that, if I am calculating the time spent by the IPOPT solver in solving the optimization problem, I should look for the total time for the Function name "ipopt (MEX-file)" in the Profile Summary report.
Am I correct?
Thanks a lot again!