Skip to content

Performance over time ​

How ComposableTuringIDModels's benchmark suites have moved across recent revisions: an overall summary across the package first, then one section per suite.

Summary ​

Each benchmark suite's headline timing across recent revisions.

SuiteMedian ratioTrendStatus
AD gradients0.99→ok
Model evaluation1.0→ok
Sampling1.08↗ok
time_to_load0.86↘ok

Ratio: latest vs oldest shown revision (1.00 = no change, higher = slower/larger). ⚠ reg = at/above the regression threshold.

Overall benchmark trend

Tables below show the most recent 4 revisions, columns labelled by commit date.

AD gradients ​

Time ​

Benchmarkv0.1.2v0.1.1v0.1.0707e3309db5acb...
AR latent logjoint/ForwardDiff12.8 ± 1.6 μs13.3 ± 8.8 μs13.2 ± 3.3 μs12.5 ± 1.9 μs
AR latent logjoint/Mooncake reverse6.06 ± 0.82 μs5.96 ± 0.84 μs5.96 ± 0.81 μs6.01 ± 0.82 μs
AR latent logjoint/ReverseDiff (tape)0.0346 ± 0.0073 ms0.0376 ± 0.0075 ms0.0372 ± 0.0078 ms0.0346 ± 0.0069 ms
DirectInfections+Poisson posterior/Enzyme reverse3.56 ± 0.3 μs0.0538 ± 0.00096 ms0.0548 ± 0.00092 ms3.55 ± 0.3 μs
DirectInfections+Poisson posterior/ForwardDiff17.5 ± 1.7 μs0.171 ± 0.0098 ms0.171 ± 0.0094 ms17.5 ± 1.6 μs
DirectInfections+Poisson posterior/Mooncake reverse7.7 ± 0.79 μs0.061 ± 0.0019 ms0.0616 ± 0.0013 ms7.4 ± 0.68 μs
DirectInfections+Poisson posterior/ReverseDiff (tape)0.0926 ± 0.02 ms0.129 ± 0.02 ms0.13 ± 0.021 ms0.0921 ± 0.019 ms

Memory ​

Benchmarkv0.1.2v0.1.1v0.1.0707e3309db5acb...
AR latent logjoint/ForwardDiff0.059 k allocs: 0.0512 MB0.056 k allocs: 0.0508 MB0.056 k allocs: 0.0508 MB0.059 k allocs: 0.0512 MB
AR latent logjoint/Mooncake reverse0.043 k allocs: 4.64 kB0.036 k allocs: 4.42 kB0.036 k allocs: 4.42 kB0.043 k allocs: 4.64 kB
AR latent logjoint/ReverseDiff (tape)0.73 k allocs: 30.4 kB0.764 k allocs: 0.0315 MB0.764 k allocs: 0.0315 MB0.73 k allocs: 30.4 kB
DirectInfections+Poisson posterior/Enzyme reverse0.036 k allocs: 4.41 kB0.244 k allocs: 12.4 kB0.244 k allocs: 12.4 kB0.037 k allocs: 4.44 kB
DirectInfections+Poisson posterior/ForwardDiff0.068 k allocs: 0.0591 MB0.68 k allocs: 0.0835 MB0.68 k allocs: 0.0835 MB0.068 k allocs: 0.0591 MB
DirectInfections+Poisson posterior/Mooncake reverse0.038 k allocs: 4.83 kB0.346 k allocs: 15.9 kB0.346 k allocs: 15.9 kB0.038 k allocs: 4.83 kB
DirectInfections+Poisson posterior/ReverseDiff (tape)1.68 k allocs: 0.0637 MB1.58 k allocs: 0.062 MB1.58 k allocs: 0.062 MB1.68 k allocs: 0.0637 MB

Model evaluation ​

Time ​

Benchmarkv0.1.2v0.1.1v0.1.0707e3309db5acb...
AR latent/forward0.582 ± 0.88 μs0.703 ± 0.86 μs1.29 ± 0.86 μs0.65 ± 0.87 μs
AR latent/rand0.706 ± 1 μs0.698 ± 0.97 μs0.693 ± 0.98 μs0.72 ± 0.99 μs
DirectInfections+Poisson/forward1.86 ± 0.17 μs0.0533 ± 0.00094 ms0.0538 ± 0.0023 ms1.83 ± 0.14 μs
DirectInfections+Poisson/rand0.76 ± 1 μs0.0525 ± 0.00088 ms0.053 ± 0.0015 ms0.798 ± 0.99 μs
RandomWalk latent/forward1.02 ± 0.68 μs1.02 ± 0.67 μs1.02 ± 0.67 μs1.01 ± 0.66 μs
RandomWalk latent/rand1.12 ± 0.78 μs1.18 ± 0.79 μs1.16 ± 0.78 μs1.13 ± 0.78 μs
Renewal+NegativeBinomial/forward6.4 ± 2.1 μs0.0572 ± 0.0013 ms0.0579 ± 0.0016 ms6.37 ± 2.2 μs
Renewal+NegativeBinomial/rand3.81 ± 2.4 μs0.0551 ± 0.0011 ms0.0558 ± 0.0016 ms3.7 ± 2.6 μs

Memory ​

Benchmarkv0.1.2v0.1.1v0.1.0707e3309db5acb...
AR latent/forward21 allocs: 2.44 kB20 allocs: 2.41 kB20 allocs: 2.41 kB21 allocs: 2.44 kB
AR latent/rand23 allocs: 2.86 kB22 allocs: 2.83 kB22 allocs: 2.83 kB23 allocs: 2.86 kB
DirectInfections+Poisson/forward23 allocs: 2.52 kB0.35 k allocs: 15.8 kB0.35 k allocs: 15.8 kB23 allocs: 2.52 kB
DirectInfections+Poisson/rand20 allocs: 2.67 kB0.349 k allocs: 15.1 kB0.349 k allocs: 15.1 kB20 allocs: 2.67 kB
RandomWalk latent/forward17 allocs: 1.86 kB16 allocs: 1.83 kB16 allocs: 1.83 kB17 allocs: 1.86 kB
RandomWalk latent/rand16 allocs: 2.08 kB15 allocs: 2.05 kB15 allocs: 2.05 kB16 allocs: 2.08 kB
Renewal+NegativeBinomial/forward0.153 k allocs: 8.28 kB0.57 k allocs: 23.7 kB0.57 k allocs: 23.7 kB0.153 k allocs: 8.28 kB
Renewal+NegativeBinomial/rand0.148 k allocs: 8.38 kB0.567 k allocs: 23 kB0.567 k allocs: 23 kB0.148 k allocs: 8.38 kB

Sampling ​

Time ​

Benchmarkv0.1.2v0.1.1v0.1.0707e3309db5acb...
NUTS (DirectInfections+Poisson, 50 draws)0.113 ± 0.0071 s0.815 ± 0.03 s0.803 ± 0.026 s0.122 ± 0.013 s

Memory ​

Benchmarkv0.1.2v0.1.1v0.1.0707e3309db5acb...
NUTS (DirectInfections+Poisson, 50 draws)0.369 M allocs: 0.252 GB2.88 M allocs: 0.354 GB2.88 M allocs: 0.354 GB0.369 M allocs: 0.252 GB

time_to_load ​

Time ​

Benchmarkv0.1.2v0.1.1v0.1.0707e3309db5acb...
time_to_load3.98 ± 0.036 s3.97 ± 0.21 s4.25 ± 0.15 s3.41 ± 0.049 s

Memory ​

Benchmarkv0.1.2v0.1.1v0.1.0707e3309db5acb...
time_to_load0.2 k allocs: 11.8 kB0.2 k allocs: 11.8 kB0.2 k allocs: 11.8 kB0.2 k allocs: 11.8 kB

Per-benchmark timelines ​

<details> <summary>Show 1 plot</summary>

plot_ComposableTuringIDModels.png

</details>

About these benchmarks ​

ComposableTuringIDModels tracks the performance of representative modelling operations over time. The suite is a prototype: it covers a small set of representative models rather than exhaustively measuring every component, and the numbers are indicative rather than a guarantee.

Benchmarking reuses the shared tooling in EpiAwarePackageTools.Benchmarks rather than re-implementing a runner or a comparison report. The package owns the suite definition (benchmark/benchmarks.jl); the kit owns running it and turning results into a legible pull-request comment.

What is measured ​

The suite is a BenchmarkTools.BenchmarkGroup named SUITE, defined in benchmark/benchmarks.jl, with three groups.

  • Model evaluation — building and evaluating representative models. For each model the suite times a prior draw (rand, which samples every random variable) and the forward pass (model(), which returns the generated quantities). The models are two latent processes (AR, RandomWalk) and two composed IDModels (DirectInfections with PoissonError, and Renewal with NegativeBinomialError), each turned into a Turing model via as_turing_model.

  • Sampling — a short NUTS run (50 draws) on a composed DirectInfections + PoissonError model conditioned on data simulated from its own prior.

  • AD gradients — the gradient of a representative log-density across automatic-differentiation backends (ForwardDiff, ReverseDiff, Mooncake, and Enzyme where supported). Results are keyed by scenario and backend so the comparison report folds them into a per-(scenario × backend) matrix.

Running the suite locally ​

The benchmark/ directory is its own Julia environment. Run the whole suite and save the results with the managed runner, which calls EpiAwarePackageTools.Benchmarks.run_suite:

sh
julia --project=benchmark benchmark/run.jl results.json

run_suite uses a short per-benchmark time budget so a full run stays affordable while the minimum-time estimator used in the comparison stays stable. To compare two result files and write a Markdown report, use the managed comparison script, which calls EpiAwarePackageTools.Benchmarks.compare_comment:

sh
julia --project=benchmark benchmark/compare.jl pr.json base.json comment.md

Continuous integration ​

Two workflows drive benchmarking in CI, both building on the shared kit.

  • benchmark.yaml runs on pull requests. It benchmarks the pull-request head and the base branch in separate jobs, then posts (and updates) a single comparison comment: a bucketed summary plus collapsed per-benchmark tables split into evaluation and AD-gradient groups.

  • benchmark-history.yaml runs on pushes to main and on tags. It benchmarks the recent tagged releases plus the current commit with AirspeedVelocity and publishes a timeline to the repository's benchmarks branch. The kit's asv_comment / flatten_asv helpers read the same AirspeedVelocity result format when a report is needed.