Skip to content
Snippets Groups Projects
Verified Commit 95ad4fee authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

Fix performance regression on models with many nested model-local variables without leads/lags

The regression was introduced in commit
84d792bc, when leads/lags were allowed on
model-local variables. The treatment of model-local variables without
leads/lags was negatively impacted. This commit fixes the regression by
restoring the former behaviour for model-local variables without leads/lags.

Reported on https://forum.dynare.org/t/pre-processing-takes-very-long/26865

Ref. dynare#1929
parent 2dca3fb5
No related branches found
No related tags found
No related merge requests found
Pipeline #11211 passed
...@@ -367,7 +367,13 @@ public: ...@@ -367,7 +367,13 @@ public:
if (it == local_variables_table.end()) if (it == local_variables_table.end())
throw UnknownLocalVariableException {symb_id}; throw UnknownLocalVariableException {symb_id};
return it->second->decreaseLeadsLags(-lead_lag); /* In the following, the case without lead/lag is optimized. It makes a difference on models
with many nested model-local variables, see e.g.
https://forum.dynare.org/t/pre-processing-takes-very-long/26865 */
if (lead_lag == 0)
return it->second;
else
return it->second->decreaseLeadsLags(-lead_lag);
} }
static void static void
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment