Opened 8 years ago

Closed 6 years ago

#3978 closed defect (fixed)

Front-end becomes slower when running multiple simulations in the same omc session

Reported by: casella Owned by: somebody
Priority: normal Milestone: 2.0.0
Component: MetaModelica Version:
Keywords: Cc:

Description

Try the following test script:

loadModel(Modelica);getErrorString();
simulate(Modelica.Mechanics.MultiBody.Examples.Systems.RobotR3.fullRobot"); getErrorString();
simulate(Modelica.Mechanics.MultiBody.Examples.Systems.RobotR3.fullRobot"); getErrorString();
simulate(Modelica.Mechanics.MultiBody.Examples.Systems.RobotR3.fullRobot"); getErrorString();

On my Linux workstation, I get the following statistics (similar results are obtained under Windows):

    timeFrontend = 2.52863065,
    timeBackend = 2.066548218,
    timeSimCode = 0.30550237,
    timeTemplates = 0.3628526,
    timeCompile = 1.114593528,
    timeSimulation = 3.508818502,

    timeFrontend = 3.725743959,
    timeBackend = 2.228759248,
    timeSimCode = 0.239114848,
    timeTemplates = 0.704168436,
    timeCompile = 1.104611544,
    timeSimulation = 3.449464435,

    timeFrontend = 3.873891418,
    timeBackend = 2.155416396,
    timeSimCode = 0.322995975,
    timeTemplates = 0.366981225,
    timeCompile = 1.159414522,
    timeSimulation = 3.55739262

On the second run, the front-end takes 50% more time to flatten the very same model, and on the third run another 5% more. On some proprietary models we get an even worse result, e.g. the second run takes three times longer than the first.

In principle the time should be the same, unless the front-end is trying to re-use some old results, in which case this turns out not to be a good idea. I would suggest to discard all old results and restart from scratch. Or maybe this is due to the garbage collection taking all this time to get rid of the old data?

Change History (7)

comment:1 Changed 8 years ago by adrpo

I guess it has to do mostly with GC and memory fragmentation.

comment:2 Changed 8 years ago by casella

What is strange is that it mostly affects the front-end, not the other phases

comment:3 Changed 8 years ago by sjoelund.se

  • Milestone changed from 1.10.0 to 1.11.0

Ticket retargeted after milestone closed

comment:4 Changed 8 years ago by sjoelund.se

  • Milestone changed from 1.11.0 to 1.12.0

Milestone moved to 1.12.0 due to 1.11.0 already being released.

comment:5 Changed 7 years ago by casella

  • Component changed from Frontend to New Instantiation
  • Milestone changed from 1.12.0 to 2.0.0
  • Owner changed from somebody to perost
  • Priority changed from high to normal
  • Status changed from new to assigned

comment:6 Changed 7 years ago by perost

  • Component changed from New Instantiation to MetaModelica
  • Owner changed from perost to somebody

Running the simulation of various models multiple times gives me inconsistent results, where different phases in both the frontend (old and new) and the backend sometimes taking up to twice as much time for no reason. I don't think there's much we can do about this, it's most likely just one of the disadvantages of using a GC. But it's not something that the new instantiation is going to fix.

comment:7 Changed 6 years ago by casella

  • Resolution set to fixed
  • Status changed from assigned to closed

Fixed, see #4906

Note: See TracTickets for help on using tickets.