﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
4398	comSubExp scales as O(N^2)	Francesco Casella	Volker Waurich	"These are the times spent by the comSubExp (simulation) backend function when compiling the ScalableTestSuite.Thermal.Advection.ScaledExperiments.SimpleAdvection_N_XXX models, see https://test.openmodelica.org/libraries/ScalableTestSuite_Experimental/BuildModelRecursive.html

||= N =||=time=||
|| 3200 || 30 ||
|| 6400 || 213 ||
||12800|| 1444 ||

The model is a very simple one
{{{
    model SimpleAdvection ""Basic thermal advection model with uniform speed""
      parameter Integer N = 2 ""Number of nodes"";
      parameter Modelica.SIunits.Temperature Tstart[N]=ones(N)*300
        ""Start value of the temperature distribution"";
      parameter Modelica.SIunits.Length L = 10 ""Pipe length"";
      final parameter Modelica.SIunits.Length l = L/N ""Length of one volume"";
      Modelica.SIunits.Velocity u = 1 ""Fluid speed"";
      Modelica.SIunits.Temperature Tin = 300 ""Inlet temperature"";
      Modelica.SIunits.Temperature T[N] ""Node temperatures"";
      Modelica.SIunits.Temperature Ttilde[N-1](start = Tstart[2:N], each fixed = true)
        ""Temperature states"";
      Modelica.SIunits.Temperature Tout;
    equation
      for j in 1:N-1 loop
        der(Ttilde[j]) = u/l*(T[j]-T[j+1]);
      end for;
      T[1] = Tin;
      T[N] = Tout;
      Ttilde = T[2:N];
end SimpleAdvection;
}}}
I'm not sure what are the common subexpressions that OMC is looking for here, but even if there were any, spending half an hour to find them doesn't really make sense. Anyway, the complexity of the algorithm shouldn't be so bad.

The problem can be traced back to a commit on either Jan 16 or Jan 17, since from the history reports, it wasn't present with  v1.12.0-dev.109+g6700d3e and it was present with  v1.12.0-dev.116+g6f8bb14. "	defect	reopened	high		Backend				Volker Waurich
