Benchmarks
This page documents performance comparisons between EpiBranch.jl and equivalent R packages. The benchmark scripts are in benchmarks/ and can be run locally to reproduce results on your own hardware.
These are indicative timings, not rigorous benchmarks. Both the R and Julia implementations are under active development, so numbers will change over time.
How to run
Julia benchmarks (requires BenchmarkTools and StableRNGs in your default environment):
julia benchmarks/benchmark_julia.jlR benchmarks (requires epichains and ringbp):
Rscript benchmarks/benchmark_r.R
Rscript benchmarks/benchmark_r_ringbp.RChain simulation (vs epichains)
Simulating 1000 transmission chains to completion, comparing EpiBranch.jl with R's epichains package.
| Scenario | R (epichains) | Julia (EpiBranch) |
|---|---|---|
| 1000 chains, Poisson(0.9) | 22.5 ms | 1.6 ms |
| 1000 chains, NegBin(0.8, 0.5) | 12.6 ms | 1.0 ms |
| 1000 chains + generation time | 31.0 ms | 1.9 ms |
| Chain statistics | 0.48 ms | 0.27 ms |
| Analytical log-likelihood | 0.15 ms | < 0.001 ms |
Intervention scenarios (vs ringbp)
Simulating 500 outbreaks with NegBin(2.5, 0.16) offspring, isolation, and contact tracing, capped at 5000 cases. Comparing EpiBranch.jl with R's ringbp package.
| Scenario | R (ringbp) | Julia (EpiBranch) |
|---|---|---|
| No interventions | 9,893 ms | 707 ms |
| 50% contact tracing | 10,374 ms | 707 ms |
| 50% tracing + quarantine | 9,319 ms | 707 ms |
The Julia column uses the same scenario (isolation + 50% contact tracing, scenario 7 in benchmark_julia.jl). The ringbp scenarios differ slightly in parameterisation (incubation-linked generation time, presymptomatic transmission fraction), so these are order-of-magnitude comparisons rather than like-for-like.
Other benchmarks
| Scenario | Julia (EpiBranch) |
|---|---|
| Line list generation (200 cases) | 0.008 ms |
| NegBin fit from 1000 offspring counts | 0.71 ms |
No direct R comparison is included for line list generation (simulist requires epiparameter database setup) or offspring fitting.
Notes
Julia timings exclude compilation (measured after warm-up using BenchmarkTools.jl)
R timings use microbenchmark
All timings are medians from multiple runs
Hardware differences will affect absolute numbers; ratios are more informative
Neither implementation is specifically optimised for speed
Last run: April 2026