Too long to find the mode in multi country model

Dear all,
I’m trying to estimate a state-space model for 36 countries using Dynare’s macrolanguage. It’s taking too long to find a mode (several days). Is there any way to speed this up? Thanks!

Have you tried profiling your code to see where the bottleneck is? If it is in the Kalman filter, you may try other Kalman filter algorithms like the univariate one.