Hi there,
I have a model that I'm fitting to some ecological data using RTMB. The dataset is large, but not gigantic, and the model is complex, but not otherworldly so (there aren't even any random effects). But it's taking a really long time to even make the tape for the R function, and obj$fn() doesn't evaluate terribly quickly either once the tape has been made.
I've done a lot of benchmarking / profiling of the R version of the function and as far as I can tell, I can't get it to run much faster than it already does in R. My question for the group is if there are any particular functions / statements / syntax that (for whatever reason) the MakeADFun / MakeTape functions struggle with a bit more than a simple evaluation of the function would. There was a previous thread in this group about single-bracket versus double-bracket indexing which I found helpful; things like that are the types of cases I have in mind and I'm wondering if my current code is littered with other such cases.
I'm more than happy to send a minimal working example + even some sample data so it's possible for others to run things, but the function is quite complicated so I'll hold off on uploading all that stuff in case there are some general suggestions that prove helpful. In short, I am using a Kalman filter to estimate parameters from a linear Gaussian state-space model. The state vectors / matrices are fairly large (~40 x 40) with the full dataset which is probably the primary driver of slowness (but they are also fairly sparse in practice so maybe there are improvements to be had there too). But please let me know if you'd find that example helpful and I'll provide it ASAP.
Thank you!
Peter