You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a REPL the trivial test model runs in about 0.03 seconds on the second run, but 20 seconds with the CLI. We put a lot of effort into making the solver fast to run. Little effort has been spent to quickly start a simulation. Users running the trivial test model from the CLI (v2024.11) need to wait 20 seconds each time. For short simulations or quick tests this hinders the iteration speed of modelers. Here is the output of hyperfine on trivial:
❯ hyperfine 'ribasim ribasim.toml'
Benchmark 1: ribasim ribasim.toml
Time (mean ± σ): 20.835 s ± 0.280 s [User: 10.951 s, System: 0.364 s]
Range (min … max): 20.606 s … 21.525 s 10 runs
Especially on a warm filesystem cache the loading of the binary is quick, Info: Starting a Ribasim simulation appears quickly. It then takes about 10 seconds for Simulating 0% to appear, and another 10 seconds for the simulation to finish.
That indicates that it still needs to compile a lot of code during a CLI run. Ten seconds worth of initialization / validation code and ten seconds of simulation code. I hoped that https://github.com/Deltares/Ribasim/blob/v2024.11.0/build/precompile.jl would precompile more of what we need, but apparently it doesn't. We can consider looking into this with SnoopCompile.jl. Right now we don't yet use PrecompileTools.jl in Ribasim.jl. We could start doing this as well.
I assume in time having small binaries with juliac will also help here.
One way to completely avoid this issue is to run Ribasim.main("ribasim.toml") from Julia instead. If we'd support some way in the CLI to run multiple model (separate TOMLs) with one command this would similarly avoid the latency when doing multiple runs each time. It may be good to support separate TOMLs also for #47.
The text was updated successfully, but these errors were encountered:
visr
added
core
Issues related to the computational core in Julia
performance
Relates to runtime performance or convergence
labels
Nov 18, 2024
In a REPL the
trivial
test model runs in about 0.03 seconds on the second run, but 20 seconds with the CLI. We put a lot of effort into making the solver fast to run. Little effort has been spent to quickly start a simulation. Users running thetrivial
test model from the CLI (v2024.11) need to wait 20 seconds each time. For short simulations or quick tests this hinders the iteration speed of modelers. Here is the output of hyperfine ontrivial
:Especially on a warm filesystem cache the loading of the binary is quick,
Info: Starting a Ribasim simulation
appears quickly. It then takes about 10 seconds forSimulating 0%
to appear, and another 10 seconds for the simulation to finish.That indicates that it still needs to compile a lot of code during a CLI run. Ten seconds worth of initialization / validation code and ten seconds of simulation code. I hoped that https://github.com/Deltares/Ribasim/blob/v2024.11.0/build/precompile.jl would precompile more of what we need, but apparently it doesn't. We can consider looking into this with SnoopCompile.jl. Right now we don't yet use PrecompileTools.jl in Ribasim.jl. We could start doing this as well.
I assume in time having small binaries with
juliac
will also help here.One way to completely avoid this issue is to run
Ribasim.main("ribasim.toml")
from Julia instead. If we'd support some way in the CLI to run multiple model (separate TOMLs) with one command this would similarly avoid the latency when doing multiple runs each time. It may be good to support separate TOMLs also for #47.The text was updated successfully, but these errors were encountered: