Benchmarks¶
This page is the engine against roadrunner on the five models of the benchmark of sbmlsim, measured on every host the engine runs on: the native engine, engine.wasm in wasmtime, engine.wasm under Node and engine.wasm in a browser. Nothing on this page is generated by the build: a new measurement is a run of the benchmark, a run of scripts/bench_figure.py and a commit of its tables and its figures.
The models are the ones of bench/sbmlsim.toml, which is sbmlsim's own benchmark and not bench/models.toml. Four of them are packaged with sbmlsim and the fifth, the liver of a normothermic machine perfusion (919 states, 2.6 MB), is the large model of its benchmark, which lives in its repository and so comes from a checkout. Every one is simulated as that benchmark simulates it: the same end, the same dose, 101 output points and the settings sbmlsim sends at the defaults of its Simulator, a relative tolerance of 1e-6 and roadrunner's vector of absolute tolerances of the base 1e-10. bench/models.toml keeps the tighter 1e-12 of the spike, so each file is comparable with itself and the two are not comparable with each other. Running the benchmark is how a benchmark is run.
One simulation¶
The separate cost of a fit measures the batch problem a parameter fit is, where one evaluation of an objective is a simulation per condition and the Jacobian of a least squares step is that evaluation once per parameter: one batch of plans over the pool is 1.9 to 5.4 times a process pool of the same width and 4.6 to 10.6 times a serial loop, and the same Jacobian inside the engine (Fitting) is 1.07 times the batch of plans, so the host of a fit of this model is a few per cent of it and the rest is the integration and the threads of the machine.
The separate GMRES machine perfusion evaluation compares opt-in, matrix-free GMRES with KLU on the 919-state model. GMRES with ILU(0) completes the workload and agrees with a tighter KLU reference at rtol 1e-12, but takes 1.29-1.32 times the native time and 1.42-1.43 times the Wasmtime time. Automatic solver selection therefore retains KLU for this model. The report includes reproducible commands and raw timing and accuracy measurements.

Every row of panels is one model, every row inside a panel one engine and the axis is logarithmic. The two columns are the two measures: the left is the time of one simulation and the right the ratio against roadrunner with the same solver, which puts roadrunner itself on the line at 1, so a mark left of that line is faster than roadrunner. A colour is an engine, the same colour in every panel, and a mark is a solver: a disc is dense and a diamond is KLU. The engine of a row is named on its axis as well, so nothing of the figure is read by colour alone. The whisker of a mark is the smallest and the largest of the round medians the cell is the median of, which is the spread of three rounds and not a confidence interval. The hosts are ordered as the engine runs them, fastest first, and the reference last; native is the engine of the wheel and is the row the figure and the tables mark.
The host decides the comparison with roadrunner. Natively the engine is faster on every model, by 1.4 to 12 times, and under V8 it is faster on every model as well, by 1.2 to 5 times (Node and Chrome). In wasmtime it is slower than roadrunner on every model but demo (1.01 to 1.37), because the code Cranelift produces is 25 to 75 % slower than V8's on the same engine.wasm: the wheel and the browser therefore both run the engine faster than the host this repository builds with. demo is the other extreme, five integration steps of a model of six states, where roadrunner's fixed cost per call dominates and the engine is 5 to 12 times faster on every host.
The two V8 hosts are not measured as sharply as the others, which the whiskers show: on the models whose simulation is under 0.25 ms the rounds of Node spread by 4 to 20 % of the median and those of Chrome by up to 30 %, against 0.3 to 2 % for the native engine and for wasmtime at every size. On those two models a difference between Node and Chrome is therefore inside the spread of each and is not a difference the benchmark resolves; from midazolam upwards both settle below 4 % and the ordering there is real. Chrome's clock also quantizes a value of that size, which is why some of its cells repeat exactly (0.025 ms, 0.4 ms) and their whiskers collapse.
The hosts integrate alike and not only in their answers: every one of the eighteen configurations of a model, a solver and a Jacobian above has the same counters of the integrator in the native engine, in wasmtime and under Node (steps, right hand side evaluations, Jacobian evaluations, nonlinear iterations, error test failures), so the times of a row are the same work done at different speeds, and the native engine of the wheel changes nothing of these results although it can differ from engine.wasm in the last bits (see Python).
The large model is measured with KLU alone, which is the solver a simulator picks for it (sbmlsim's linear_solver="auto" takes KLU above twelve states): a dense factorization of a 919 by 919 matrix costs 5.9 s per simulation in wasmtime against 0.069 s with KLU, and roadrunner takes 2.0 s against 0.050 s, so the dense cells of that row are not measured rather than reported.
Milliseconds per simulation¶
| model (states) | solver | native | node | chrome | wasmtime | roadrunner |
|---|---|---|---|---|---|---|
| repressilator (6) | dense | 0.139 | 0.199 | 0.185 | 0.294 | 0.278 |
| repressilator (6) | klu | 0.138 | 0.207 | 0.2 | 0.305 | 0.274 |
| demo (6) | dense | 0.00971 | 0.021 | 0.025 | 0.0201 | 0.115 |
| demo (6) | klu | 0.0108 | 0.0236 | 0.025 | 0.023 | 0.116 |
| midazolam (38) | dense | 0.375 | 0.462 | 0.453 | 0.741 | 0.565 |
| midazolam (38) | klu | 0.226 | 0.321 | 0.315 | 0.522 | 0.402 |
| hctz (28) | dense | 0.443 | 0.507 | 0.5 | 0.845 | 0.837 |
| hctz (28) | klu | 0.321 | 0.408 | 0.405 | 0.691 | 0.662 |
| perfusion (919) | klu | 37.1 | 41.8 | 42.2 | 68.7 | 50.3 |
The ratio against roadrunner with the same solver¶
| model (states) | solver | native | node | chrome | wasmtime |
|---|---|---|---|---|---|
| repressilator (6) | dense | 0.50 | 0.72 | 0.67 | 1.06 |
| repressilator (6) | klu | 0.50 | 0.76 | 0.73 | 1.11 |
| demo (6) | dense | 0.08 | 0.18 | 0.22 | 0.18 |
| demo (6) | klu | 0.09 | 0.20 | 0.21 | 0.20 |
| midazolam (38) | dense | 0.66 | 0.82 | 0.80 | 1.31 |
| midazolam (38) | klu | 0.56 | 0.80 | 0.78 | 1.30 |
| hctz (28) | dense | 0.53 | 0.61 | 0.60 | 1.01 |
| hctz (28) | klu | 0.48 | 0.62 | 0.61 | 1.04 |
| perfusion (919) | klu | 0.74 | 0.83 | 0.84 | 1.37 |
Through python¶
A library which drives the engine adds its own cost per simulation, which can be larger than the simulation. sbmlsim reported the engine at 0.43 to 2.34 ms for these same four simulations while the engine itself takes 0.0095 to 0.45 ms, because its python layer cost 1.19 to 1.93 ms per simulation and the wheel ran the slowest host. Both were answered, and bench/SBMLSIM.md is the measurement of each layer.
The method¶
Every cell is the median of 20 runs after 3 warm ups, in 3 rounds, with the configurations taking turns so a change of the load of the machine reaches every one of them alike, and every timed simulation repeated the bits of the first. One performance core (taskset -c 2, Chrome on 4-15). roadrunner is libroadrunner 2.12.0 with its own defaults, so its KLU column is the sparse direct solver and the colored sparse difference quotient Jacobian of roadrunner 2.12. Node 24.21.0, headless Chrome 157 in a cross-origin isolated module worker, wasmtime 50.0.1 (Cranelift), the native engine compiled for the machine.
uv run scripts/prepare_model.py --bench bench/sbmlsim.toml
cargo build --release --features native
SMALL=repressilator,demo,midazolam,hctz
EXPORT=target/bench/sb-export
# the engine, every host; the large model with KLU alone, into the same export
taskset -c 2 target/release/sbmlsim-core bench bench/sbmlsim.toml --only $SMALL \
--json target/bench/sb-wasmtime-a.json --export $EXPORT
taskset -c 2 target/release/sbmlsim-core bench bench/sbmlsim.toml --only perfusion --solvers klu \
--json target/bench/sb-wasmtime-b.json --export $EXPORT
taskset -c 2 target/release/sbmlsim-core bench bench/sbmlsim.toml --only $SMALL \
--json target/bench/sb-native-a.json --host native
taskset -c 2 target/release/sbmlsim-core bench bench/sbmlsim.toml --only perfusion --solvers klu \
--json target/bench/sb-native-b.json --host native
target/release/sbmlsim-core runtime -o js/runtime
taskset -c 2 node js/bench.mjs $EXPORT --json target/bench/sb-node.json
taskset -c 4-15 node bench/web/serve.mjs target/bench/sb-chrome.json --port 8771 &
taskset -c 4-15 google-chrome --headless=new --disable-gpu \
"http://localhost:8771/bench/web/index.html?export=/$EXPORT"
# roadrunner, and the tables and the figures of this page
uv run scripts/roadrunner_reference.py bench/sbmlsim.toml --only $SMALL \
--json target/bench/sb-roadrunner-a.json
uv run scripts/roadrunner_reference.py bench/sbmlsim.toml --only perfusion \
--json target/bench/sb-roadrunner-b.json
uv run scripts/bench_figure.py target/bench/sb --out docs/images
The two runs of a host are one file per host (sb-<host>.json, the models of the second added to the first), since the large model is measured with KLU alone while the four small ones are measured with both solvers, and the export of the JavaScript hosts holds all five models. scripts/roadrunner_reference.py has no switch for the solver and measures the large model with both, which is where the dense number above comes from; only its KLU is a cell of the tables, and skipping that run of 34 minutes costs nothing but that one number.
Running the benchmark against roadrunner¶
bench/models.toml lists the models of the benchmark against roadrunner; bench/RESULTS.md has the method and the results. bench/sbmlsim.toml is a second list, the five models of the benchmark of sbmlsim as it simulates them, measured on this page, with which bench/SBMLSIM.md reads the raw speed of the engine against the speed sbmlsim measures through python; the two lists carry different tolerances and output grids and are not comparable with each other. A model with comp, distrib or of another level is prepared first (scripts/prepare_model.py, see Compiling a model):
uv run scripts/prepare_model.py --bench bench/models.toml # into target/bench-models/
taskset -c 2 sbmlsim-core bench bench/models.toml --json target/bench/engine.json --export target/bench/export
taskset -c 2 sbmlsim-core bench bench/models.toml --host native --json target/bench/native.json
taskset -c 2 node js/bench.mjs target/bench/export --json target/bench/node.json
node bench/web/serve.mjs target/bench/chrome.json & # then open http://127.0.0.1:8765/bench/web/index.html
uv run scripts/roadrunner_reference.py bench/models.toml --json target/bench/roadrunner.json
uv run scripts/agreement.py # the engine at rtol 1e-10 against roadrunner at 1e-12 (dense, KLU)
The models: two PBPK models of sbmlsim (hctz, 28 states; midazolam, 38), an event model (repeated_dose, an oral dose every 8 h), two machine perfusion models of the liver (mp_core, 43 states; mp_flat, 919) and Chen 2009 of the PEtab benchmark collection (500 states).
- The threshold of the project is at most 2x the simulation time of roadrunner native (LLJIT
O2), dense and with KLU. No ratio is above it: the largest is 1.38 (the event model, dense, an output of 201 times, wasmtime); the PBPK models take 0.57 to 0.83 of roadrunner's time in wasmtime, Node and Chrome (0.45 to 0.61 natively), Chen and mp_flat 0.16 to 0.97 with KLU and 1.10 to 1.31 dense. - The native engine (
--host native: the engine compiled for the machine, the model in wasmtime) is the bound of the integrator without WebAssembly; Node and Chrome agree within a few percent and take 1.0 to 1.3 of its time, wasmtime 1.2 to 1.5. - The counters of the integrator are the same in wasmtime, Node and Chrome for every configuration (one
engine.wasm, the same bits), and every timed simulation repeated the bits of the first. KLU_THRESHOLDis 12: KLU (in the ordering AMD) with the analytic Jacobian is as fast as the dense solver at 11 to 12 states and faster above (0.6 of the dense time at 64 states).- Agreement: the engine at rtol 1e-10 against roadrunner at rtol 1e-12, within
1e-12 + 1e-7 |c|, or its largest excess at most 1 % above the one of roadrunner at rtol 1e-10 with the same linear solver. Every model passes with the dense solver and with KLU.
js/bench.mjs reads engine.wasm from SBMLSIM_CORE_RUNTIME, else js/runtime. The KLU baseline of roadrunner is a roadrunner-sparsedq build (libroadrunner with KLU and its colored sparse difference quotient) when SBMLSIM_CORE_SPARSEDQ_BUILD names its site-packages directory (or --sparse-build); without it roadrunner_reference.py takes the KLU of the libroadrunner 2.12 of its environment.