-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Performance: avoid creation of new Quantity-objects in getOutputValues #462
Comments
That I find very surprising. How large is your model? |
Yes this is crazy. Well, the model is quite large - the exported pkml is 50mb...
And Retrieving only state variable parameters would be a great improvement, but I did not find how to do it directly. |
40k parameters lol How do I read this perf graph? I see the number of time a method is called but I don't see the overall time |
But matching is performed in .net, right? OSPSuite-R/R/utilities-entity.R Lines 105 to 122 in 44d8471
This is fast, definitely not the bottle-neck.
Those are the ms spent on each line. What I try to show here that a great amount of time in spent on formula-related tasks. For each .net-quantity, an r-Quantity is created and "GetFormula" and "self$isTable" (which calls |
self$isTable is 45s ?? WHAT? We are accessing a boolean variable here |
There are cleary some stuff to explore. self$isTable just calls self$formula$isTable. This could be cached. However it seems to be only called once anyway. Maybe the call in .NET takes time (I don't understand how) |
In one particular scenario I have identified a bottleneck in the performance of retrieving the output values of simulated results.
I am simulating a steady-state of the model. For this, I first retrieve all quantities that are described by an ODE - first all molecules, and then all parameters and sorting the parameters that are state variable:
This already takes almost 4 minutes, and the majority of time is spent on creating the quantities, in particular in creating the quantities' formula objects:
OSPSuite-R/R/quantity.R
Lines 93 to 97 in 44d8471
Once identified all quantities (lets call them
allQuantities
), these are used as outputs in the simulation. Simulating and getting the results consumes 53 seconds, of which only 20 seconds are for the simulation itself - the other 30 seconds are spent on getting the results. Once again, much time is spent on creatingQuantity
-objects, including here:OSPSuite-R/R/utilities-simulation-results.R
Lines 81 to 85 in 44d8471
However, creating Quantity-objects is not necessary if a list of quantities is provided instead of paths. By re-writing the method I could improve the time from 53 to 40 seconds - which is not negligible if the scenario is performed multiple times (e.g. in a parameter identification).
I will submit a PR.
The text was updated successfully, but these errors were encountered: