Skip to content
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

cutting down on allocations #21

Open
anandijain opened this issue Jul 21, 2021 · 0 comments
Open

cutting down on allocations #21

anandijain opened this issue Jul 21, 2021 · 0 comments

Comments

@anandijain
Copy link
Contributor

https://docs.julialang.org/en/v1/manual/profile/#Memory-allocation-analysis

for example take https://www.ebi.ac.uk/biomodels/BIOMD0000000469

julia> @benchmark SBML.readSBML(fn, doc -> begin
                   set_level_and_version(3, 2)(doc)
                   convert_simplify_math(doc)
               end)
BenchmarkTools.Trial: 1 sample with 1 evaluation.
 Single result which took 21.036 s (0.00% GC) to evaluate,
 with a memory estimate of 8.22 MiB, over 254217 allocations.

julia> @benchmark ODESystem(m)
BenchmarkTools.Trial: 1 sample with 1 evaluation.
 Single result which took 15.338 s (5.20% GC) to evaluate,
 with a memory estimate of 3.68 GiB, over 89488902 allocations.

We can see with these results that the vast majority of allocs are in constructing ODESystem. It also gets much much worse as model size increases. It is quite shocking to see ~4 GiB allocated for a 2MB file.

I'm pretty sure with just improving the code we can get 15 seconds down at least 2x. This will be very helpful for running tests against the biomodels dataset, which currently takes an incredible amount of time.

One issue is that there is an excessive amount of create_var and create_param. There should only be length(m.species) number of calls to create_var, and similarly for params and length(m.parameters) + length(m.compartments).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant