Open-Systems-Pharmacology / PK-Sim

PK-Sim® is a comprehensive software tool for whole-body physiologically based pharmacokinetic modeling
Other
105 stars 50 forks source link

Load sim from snapshot much slower in v10 than v9 #1761

Closed msevestre closed 3 years ago

msevestre commented 3 years ago

Follow up https://github.com/Open-Systems-Pharmacology/PK-Sim/pull/1759#issuecomment-843292984

It takes about 9sec to load this file from snapshot in v9 vs 23 sec in v10 (this is BEFORE simulating).

LongTime.zip

msevestre commented 3 years ago

/cc @Yuri05

msevestre commented 3 years ago

@Yuri05 It might be becaused I am in debug... let me see

msevestre commented 3 years ago

16sec in release. Still much slower. WTF

msevestre commented 3 years ago

@Yuri05 Ok so I investigated a bit (Comparing v9 and v10) I feell that our simulations are just more complex than before. e.g. more parameters,. more containers etc... I am not sure how to quantify this but Modelconstruction alone has gone from 6sec t9 9sec image

Running simulation, load from xml is also a bit slower etc... I

image

At the end , we add a few seconds here and there and it accounts for the difference. Now this simulation is maybe a bit complicated but still, we can see the difference clearly image

Should we care?

StephanSchaller commented 3 years ago

Should we care?

I vote for yes ;-) ... is the "increased complexity of models" due to the new expression interface (proteins are created in more compartments than before)? Maybe this is only an issue for "old" models and project conversion and maybe we can optimize how we translate the old expression settings to the new (and remove a few "is present" flags for proteins)?

Yuri05 commented 3 years ago

"We care a lot" 😄

maybe we can optimize how we translate the old expression settings to the new (and remove a few "is present" flags for proteins)

I would not do this. The whole idea with "fraction expressed XXX" was that the localization of proteins can be changed just by setting those parameters. If we start to remove "is present" if fraction expressed XXX=0 then we will get once again simulations with "dead" parameters and no possibility to change the proteins localization.

And yes, simulations with many proteins are much bigger now (proteins everywhere, lot of additional parameters).

StephanSchaller commented 3 years ago

If we start to remove "is present" if fraction expressed XXX=0 then we will get once again simulations with "dead" parameters and no possibility to change the proteins localization.

Not for "fraction expressed XXX=0" but when the compartment is not checked (or is this already the case? E.g. if the user explicitly "un-checks" the location where the protein might be located --> is present = false? Otherwise this localization can always be changed later to change localization... I think by default we should try to keep the models a "trim" as possible for optimized performance...

msevestre commented 3 years ago

So i ran some numbers in v8, v9 and v10 The project above where I ran 100 individuals

v8: 2min 50, 2min50 v9: 2min50. 2min50 v10: 2min30, 2min30

So while the creation of one simulation seeems to be longer, the running of a population is faster...

msevestre commented 3 years ago

Let's close this for now until we see if this is really a problem