Performance over time
How ComposableRecurrences'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.
| Suite | Median ratio | Trend | Status |
|---|---|---|---|
| AD gradients | 3.84 | ↗ | ⚠ reg |
| Convolution body | 3.01 | ↗ | ⚠ reg |
| Evaluation | 0.49 | ↘ | ok |
| time_to_load | 5.11 | ↗ | ⚠ reg |
Ratio: latest vs oldest shown revision (1.00 = no change, higher = slower/larger). ⚠ reg = at/above the regression threshold.

Tables below show the most recent 3 revisions, columns labelled by commit date.
AD gradients
Time
| Benchmark | v0.1.0 | 2026-11-30 | v0.1.0 / 4b4bc8cfd453de... |
|---|---|---|---|
| Matrix bvd_renewal_call T200_L20_S1/Enzyme reverse | 0.0521 ± 0.0094 ms | 18.5 ± 5.2 μs | 2.82 ± 0.94 |
| Matrix bvd_renewal_call T200_L20_S1/ForwardDiff | 1.4 ± 0.032 ms | 0.559 ± 0.017 ms | 2.5 ± 0.095 |
| Matrix bvd_renewal_call T200_L20_S1/Mooncake reverse | 0.0747 ± 0.014 ms | 23.5 ± 6.6 μs | 3.19 ± 1.1 |
| Matrix conv_fixed T200_L20_S1/Enzyme reverse | 12.1 ± 2.9 μs | 2.63 ± 2.7 μs | 4.61 ± 4.9 |
| Matrix conv_fixed T200_L20_S1/ForwardDiff | 0.823 ± 0.016 ms | 0.232 ± 0.016 ms | 3.54 ± 0.26 |
| Matrix conv_fixed T200_L20_S1/Mooncake reverse | 0.0364 ± 0.015 ms | 9.18 ± 1.5 μs | 3.96 ± 1.7 |
| Matrix delay_fixed T200_L20_S1/Enzyme reverse | 10.4 ± 2.4 μs | 4.69 ± 3.3 μs | 2.22 ± 1.7 |
| Matrix delay_fixed T200_L20_S1/ForwardDiff | 0.922 ± 0.033 ms | 0.265 ± 0.01 ms | 3.47 ± 0.19 |
| Matrix delay_fixed T200_L20_S1/Mooncake reverse | 24 ± 1.2 μs | 9 ± 2 μs | 2.67 ± 0.6 |
| Matrix overview T200_L20_S3/Enzyme reverse | 0.261 ± 0.037 ms | 31 ± 17 μs | 8.41 ± 4.7 |
| Matrix overview T200_L20_S3/ForwardDiff | 14.7 ± 2.6 ms | 1.89 ± 0.073 ms | 7.77 ± 1.4 |
| Matrix overview T200_L20_S3/Mooncake reverse | 0.287 ± 0.026 ms | 0.0427 ± 0.0016 ms | 6.71 ± 0.66 |
| Matrix random_walk T30_L1_S1/Enzyme reverse | 3.06 ± 0.48 μs | 0.131 ± 0.011 μs | 23.3 ± 4.2 |
| Matrix random_walk T30_L1_S1/ForwardDiff | 5.66 ± 1.4 μs | 3.08 ± 0.59 μs | 1.84 ± 0.57 |
| Matrix random_walk T30_L1_S1/Mooncake reverse | 8.02 ± 0.99 μs | 0.651 ± 0.03 μs | 12.3 ± 1.6 |
| Matrix renewal T200_L20_S1/Enzyme reverse | 27 ± 6.1 μs | 6.58 ± 4.2 μs | 4.11 ± 2.8 |
| Matrix renewal T200_L20_S1/ForwardDiff | 1.08 ± 0.031 ms | 0.37 ± 0.016 ms | 2.92 ± 0.15 |
| Matrix renewal T200_L20_S1/Mooncake reverse | 0.046 ± 0.013 ms | 13.1 ± 4.4 μs | 3.51 ± 1.5 |
| Matrix strata_mixing T200_L20_S5/Enzyme reverse | 0.38 ± 0.048 ms | 0.0481 ± 0.018 ms | 7.89 ± 3.1 |
| Matrix strata_mixing T200_L20_S5/ForwardDiff | 0.0317 ± 0.0025 s | 9.92 ± 1.9 ms | 3.19 ± 0.66 |
| Matrix strata_mixing T200_L20_S5/Mooncake reverse | 0.359 ± 0.029 ms | 0.0698 ± 0.0057 ms | 5.14 ± 0.59 |
| Matrix bvd_patches_call T200_L20_S1/ForwardDiff | 1.03 ± 0.074 ms | ||
| Matrix bvd_patch T200_L20_S5/Mooncake reverse | 0.0874 ± 0.0041 ms | ||
| Matrix tv_piecewise_secondary_k5 T200_L20_S1/Mooncake reverse | 17.5 ± 2.8 μs | ||
| Matrix bvd_patches_call T200_L20_S1/Mooncake reverse | 0.0395 ± 0.0013 ms | ||
| Matrix tv_piecewise_renewal_primary_k5 T200_L20_S1/ForwardDiff | 0.484 ± 0.026 ms | ||
| Matrix tv_piecewise_renewal_secondary_k5 T200_L20_S1/ForwardDiff | 0.633 ± 0.027 ms | ||
| Matrix tv_piecewise_renewal_primary_k5 T200_L20_S1/Mooncake reverse | 23.4 ± 6.4 μs | ||
| Matrix bvd_patches_call T200_L20_S1/Enzyme reverse | 30 ± 1.1 μs | ||
| Matrix bvd_patches_call T200_L20_S5/Mooncake reverse | 0.113 ± 0.006 ms | ||
| Matrix tv_piecewise_secondary_k5 T200_L20_S1/Enzyme reverse | 11.9 ± 4.5 μs | ||
| Matrix tv_piecewise_primary_k5 T200_L20_S1/Mooncake reverse | 18 ± 2.7 μs | ||
| Matrix tv_piecewise_renewal_secondary_k5 T200_L20_S1/Enzyme reverse | 15.6 ± 6.1 μs | ||
| Matrix bvd_patches_call T200_L20_S5/Enzyme reverse | 0.0848 ± 0.0046 ms | ||
| Matrix tv_piecewise_primary_k5 T200_L20_S1/ForwardDiff | 0.44 ± 0.024 ms | ||
| Matrix bvd_patch T200_L20_S5/Enzyme reverse | 0.0668 ± 0.0063 ms | ||
| Matrix tv_piecewise_secondary_k5 T200_L20_S1/ForwardDiff | 0.442 ± 0.024 ms | ||
| Matrix bvd_patch T200_L20_S5/ForwardDiff | 11 ± 2.1 ms | ||
| Matrix tv_piecewise_primary_k5 T200_L20_S1/Enzyme reverse | 11.7 ± 5.3 μs | ||
| Matrix tv_piecewise_renewal_primary_k5 T200_L20_S1/Enzyme reverse | 18.8 ± 4.4 μs | ||
| Matrix bvd_patches_call T200_L20_S5/ForwardDiff | 30.5 ± 2 ms | ||
| Matrix tv_piecewise_renewal_secondary_k5 T200_L20_S1/Mooncake reverse | 22.1 ± 3.9 μs |
Memory
| Benchmark | v0.1.0 | 2026-11-30 | v0.1.0 / 4b4bc8cfd453de... |
|---|---|---|---|
| Matrix bvd_renewal_call T200_L20_S1/Enzyme reverse | 0.118 k allocs: 0.0363 MB | 0.053 k allocs: 28.5 kB | 1.31 |
| Matrix bvd_renewal_call T200_L20_S1/ForwardDiff | 0.949 k allocs: 2.53 MB | 0.465 k allocs: 2.03 MB | 1.25 |
| Matrix bvd_renewal_call T200_L20_S1/Mooncake reverse | 1.91 k allocs: 0.0821 MB | 0.057 k allocs: 0.0325 MB | 2.53 |
| Matrix conv_fixed T200_L20_S1/Enzyme reverse | 0.046 k allocs: 25.8 kB | 29 allocs: 14.4 kB | 1.78 |
| Matrix conv_fixed T200_L20_S1/ForwardDiff | 0.344 k allocs: 1.93 MB | 0.23 k allocs: 1.18 MB | 1.64 |
| Matrix conv_fixed T200_L20_S1/Mooncake reverse | 0.328 k allocs: 0.062 MB | 0.036 k allocs: 18.5 kB | 3.43 |
| Matrix delay_fixed T200_L20_S1/Enzyme reverse | 0.044 k allocs: 23.1 kB | 24 allocs: 16 kB | 1.44 |
| Matrix delay_fixed T200_L20_S1/ForwardDiff | 0.302 k allocs: 1.68 MB | 0.182 k allocs: 0.842 MB | 1.99 |
| Matrix delay_fixed T200_L20_S1/Mooncake reverse | 0.328 k allocs: 0.0566 MB | 24 allocs: 15.9 kB | 3.64 |
| Matrix overview T200_L20_S3/Enzyme reverse | 1.51 k allocs: 0.235 MB | 0.091 k allocs: 0.074 MB | 3.18 |
| Matrix overview T200_L20_S3/ForwardDiff | 2.71 k allocs: 24.9 MB | 1.05 k allocs: 9.33 MB | 2.66 |
| Matrix overview T200_L20_S3/Mooncake reverse | 5.84 k allocs: 0.353 MB | 0.078 k allocs: 0.0695 MB | 5.08 |
| Matrix random_walk T30_L1_S1/Enzyme reverse | 0.033 k allocs: 4.02 kB | 9 allocs: 1.47 kB | 2.73 |
| Matrix random_walk T30_L1_S1/ForwardDiff | 0.056 k allocs: 28.6 kB | 20 allocs: 17.6 kB | 1.63 |
| Matrix random_walk T30_L1_S1/Mooncake reverse | 0.327 k allocs: 11.7 kB | 14 allocs: 1.86 kB | 6.31 |
| Matrix renewal T200_L20_S1/Enzyme reverse | 0.043 k allocs: 26.8 kB | 31 allocs: 20.1 kB | 1.33 |
| Matrix renewal T200_L20_S1/ForwardDiff | 0.522 k allocs: 1.77 MB | 0.322 k allocs: 1.32 MB | 1.34 |
| Matrix renewal T200_L20_S1/Mooncake reverse | 1.7 k allocs: 0.0669 MB | 0.034 k allocs: 19.8 kB | 3.45 |
| Matrix strata_mixing T200_L20_S5/Enzyme reverse | 1.35 k allocs: 0.267 MB | 0.083 k allocs: 0.134 MB | 1.99 |
| Matrix strata_mixing T200_L20_S5/ForwardDiff | 3.46 k allocs: 0.0507 GB | 2.31 k allocs: 30.9 MB | 1.68 |
| Matrix strata_mixing T200_L20_S5/Mooncake reverse | 8.37 k allocs: 0.35 MB | 0.133 k allocs: 0.12 MB | 2.92 |
| Matrix bvd_patches_call T200_L20_S1/ForwardDiff | 1.93 k allocs: 7.91 MB | ||
| Matrix bvd_patch T200_L20_S5/Mooncake reverse | 0.158 k allocs: 0.129 MB | ||
| Matrix tv_piecewise_secondary_k5 T200_L20_S1/Mooncake reverse | 0.089 k allocs: 0.035 MB | ||
| Matrix bvd_patches_call T200_L20_S1/Mooncake reverse | 0.173 k allocs: 0.0602 MB | ||
| Matrix tv_piecewise_renewal_primary_k5 T200_L20_S1/ForwardDiff | 1.52 k allocs: 2.54 MB | ||
| Matrix tv_piecewise_renewal_secondary_k5 T200_L20_S1/ForwardDiff | 1.52 k allocs: 2.65 MB | ||
| Matrix tv_piecewise_renewal_primary_k5 T200_L20_S1/Mooncake reverse | 0.118 k allocs: 0.0369 MB | ||
| Matrix bvd_patches_call T200_L20_S1/Enzyme reverse | 0.136 k allocs: 0.0636 MB | ||
| Matrix bvd_patches_call T200_L20_S5/Mooncake reverse | 0.196 k allocs: 0.262 MB | ||
| Matrix tv_piecewise_secondary_k5 T200_L20_S1/Enzyme reverse | 0.077 k allocs: 26.8 kB | ||
| Matrix tv_piecewise_primary_k5 T200_L20_S1/Mooncake reverse | 0.089 k allocs: 0.035 MB | ||
| Matrix tv_piecewise_renewal_secondary_k5 T200_L20_S1/Enzyme reverse | 0.105 k allocs: 29.9 kB | ||
| Matrix bvd_patches_call T200_L20_S5/Enzyme reverse | 0.156 k allocs: 0.288 MB | ||
| Matrix tv_piecewise_primary_k5 T200_L20_S1/ForwardDiff | 0.953 k allocs: 2.76 MB | ||
| Matrix bvd_patch T200_L20_S5/Enzyme reverse | 0.119 k allocs: 0.135 MB | ||
| Matrix tv_piecewise_secondary_k5 T200_L20_S1/ForwardDiff | 0.953 k allocs: 2.76 MB | ||
| Matrix bvd_patch T200_L20_S5/ForwardDiff | 3.36 k allocs: 31.4 MB | ||
| Matrix tv_piecewise_primary_k5 T200_L20_S1/Enzyme reverse | 0.077 k allocs: 26.8 kB | ||
| Matrix tv_piecewise_renewal_primary_k5 T200_L20_S1/Enzyme reverse | 0.105 k allocs: 28.9 kB | ||
| Matrix bvd_patches_call T200_L20_S5/ForwardDiff | 9.21 k allocs: 0.182 GB | ||
| Matrix tv_piecewise_renewal_secondary_k5 T200_L20_S1/Mooncake reverse | 0.118 k allocs: 0.0386 MB |
Convolution body
Time
| Benchmark | v0.1.0 | 2026-11-30 | v0.1.0 / 4b4bc8cfd453de... |
|---|---|---|---|
| BLAS axpy per lag | 0.439 ± 0.0012 μs | 0.35 ± 0.0015 μs | 1.25 ± 0.0064 |
| native axpy per lag | 0.338 ± 0.0029 μs | 0.256 ± 0.0019 μs | 1.32 ± 0.015 |
| package | 0.44 ± 0.0019 μs | 0.168 ± 0.0005 μs | 2.62 ± 0.014 |
Memory
| Benchmark | v0.1.0 | 2026-11-30 | v0.1.0 / 4b4bc8cfd453de... |
|---|---|---|---|
| BLAS axpy per lag | 0 allocs: 0 B | 0 allocs: 0 B | |
| native axpy per lag | 0 allocs: 0 B | 0 allocs: 0 B | |
| package | 0 allocs: 0 B | 0 allocs: 0 B |
Evaluation
Time
| Benchmark | v0.1.0 | 2026-11-30 | v0.1.0 / 4b4bc8cfd453de... |
|---|---|---|---|
| Matrix bvd_renewal_call T200_L20_S1 | 9.64 ± 2.3 μs | 5.92 ± 2.2 μs | 1.63 ± 0.73 |
| Matrix conv_fixed T200_L20_S1 | 1.32 ± 1.8 μs | 1.56 ± 0.3 μs | 0.846 ± 1.1 |
| Matrix delay_fixed T200_L20_S1 | 2.75 ± 1.1 μs | 0.871 ± 0.26 μs | 3.16 ± 1.6 |
| Matrix overview T200_L20_S3 | 19.7 ± 1 μs | 10.8 ± 0.47 μs | 1.83 ± 0.12 |
| Matrix random_walk T30_L1_S1 | 0.31 ± 0.23 μs | 0.06 ± 0.1 μs | 5.17 ± 9.4 |
| Matrix renewal T200_L20_S1 | 3.73 ± 2 μs | 1.95 ± 0.24 μs | 1.91 ± 1.1 |
| Matrix strata_mixing T200_L20_S5 | 23.4 ± 0.97 μs | 16.6 ± 1.2 μs | 1.41 ± 0.12 |
| Matrix tv_piecewise_renewal_primary_k5 T200_L20_S1 | 4.5 ± 2.9 μs | ||
| Matrix tv_piecewise_secondary_k5 T200_L20_S1 | 2.04 ± 1.7 μs | ||
| Matrix bvd_patch T200_L20_S5 | 23.7 ± 6.3 μs | ||
| Matrix tv_piecewise_primary_k5 T200_L20_S1 | 3.72 ± 1.3 μs | ||
| Matrix tv_piecewise_renewal_secondary_k5 T200_L20_S1 | 4.96 ± 2.2 μs | ||
| Matrix bvd_patches_call T200_L20_S5 | 0.0325 ± 0.0014 ms | ||
| Matrix bvd_patches_call T200_L20_S1 | 14.1 ± 2.8 μs |
Memory
| Benchmark | v0.1.0 | 2026-11-30 | v0.1.0 / 4b4bc8cfd453de... |
|---|---|---|---|
| Matrix bvd_renewal_call T200_L20_S1 | 0.035 k allocs: 10.1 kB | 15 allocs: 7.73 kB | 1.31 |
| Matrix conv_fixed T200_L20_S1 | 12 allocs: 8.38 kB | 9 allocs: 5.14 kB | 1.63 |
| Matrix delay_fixed T200_L20_S1 | 10 allocs: 6.92 kB | 9 allocs: 5.33 kB | 1.3 |
| Matrix overview T200_L20_S3 | 0.052 k allocs: 0.0399 MB | 22 allocs: 20.1 kB | 2.03 |
| Matrix random_walk T30_L1_S1 | 15 allocs: 1.19 kB | 4 allocs: 0.594 kB | 2 |
| Matrix renewal T200_L20_S1 | 19 allocs: 7.48 kB | 11 allocs: 5.53 kB | 1.35 |
| Matrix strata_mixing T200_L20_S5 | 0.044 k allocs: 0.0432 MB | 23 allocs: 0.0331 MB | 1.3 |
| Matrix tv_piecewise_renewal_primary_k5 T200_L20_S1 | 0.041 k allocs: 11.3 kB | ||
| Matrix tv_piecewise_secondary_k5 T200_L20_S1 | 27 allocs: 9.73 kB | ||
| Matrix bvd_patch T200_L20_S5 | 0.033 k allocs: 0.0338 MB | ||
| Matrix tv_piecewise_primary_k5 T200_L20_S1 | 27 allocs: 9.73 kB | ||
| Matrix tv_piecewise_renewal_secondary_k5 T200_L20_S1 | 0.041 k allocs: 11.7 kB | ||
| Matrix bvd_patches_call T200_L20_S5 | 0.046 k allocs: 0.0821 MB | ||
| Matrix bvd_patches_call T200_L20_S1 | 0.039 k allocs: 18 kB |
time_to_load
Time
| Benchmark | v0.1.0 | 2026-11-30 | v0.1.0 / 4b4bc8cfd453de... |
|---|---|---|---|
| time_to_load | 0.146 ± 0.001 s | 0.195 ± 0.0021 s | 0.746 ± 0.0097 |
Memory
| Benchmark | v0.1.0 | 2026-11-30 | v0.1.0 / 4b4bc8cfd453de... |
|---|---|---|---|
| time_to_load | 0.2 k allocs: 11.8 kB | 0.2 k allocs: 11.8 kB | 1 |
Skipped & broken benchmarks
No known skipped or broken benchmarks.
Per-benchmark timelines
<details> <summary>Show 2 plots</summary>


</details>
About these benchmarks
Against hand-written code
The aim is to be as fast as hand-written code with hand-written adjoints. Each tutorial's model is timed against a hand-written loop of the same model, differentiated by the same backend. The table gives the loop's minimum time over the package's, so above 1 the package is faster and below 1 it is slower.
performance_table()| Block | Case | Size | Forward run | ForwardDiff | Mooncake | Enzyme |
|---|---|---|---|---|---|---|
| naive vs package | overview | T200_L20_S3 | 1.5× | 2.2× | 10.9× | 4.3× |
| backend renewal | bvd_renewal | T400_L60_S1 | 1.8× | 3.6× | 4.1× | 2.9× |
| backend patches | bvd_patches | T400_L60_S11 | 1.5× | 2.2× | 9.1× | 4.4× |
| backend delay | bvd_delay | T400_L60_S1 | 1.0× | 3.7× | 5.2× | 2.3× |
| renewal | renewal_depletion | T200_L20_S1 | 1.4× | 0.8× | 4.0× | 1.7× |
| vaccination | strata_waning | T200_L20_S1 | 0.7× | 0.9× | 2.4× | 1.0× |
| imports | renewal_imports | T200_L20_S1 | 1.2× | 1.0× | 2.7× | 0.8× |
| clinical outcomes | outcome_chain | T200_L20_S1 | 2.2× | 1.4× | 6.5× | 5.0× |
| forecasting | renewal_forecast | T200_L20_S1 | 2.1× | 0.8× | 4.5× | 1.8× |
| reproduction number | reproduction | T200_L20_S3 | 0.6× | 1.0× | 3.9× | 1.2× |
| spatial strata | strata_routes | T200_L20_S5 | 1.1× | 1.0× | 7.0× | 7.1× |
| occupancy | ward_flows | T200_L20_S1 | 0.6× | 0.8× | 1.0× | 2.2× |
| latent processes | ar | T200_L20_S1 | 0.9× | 0.8× | 1.7× | 0.8× |
| time-varying delays | delay_primary | T200_L15_S1 | 0.9× | 0.8× | 4.6× | 5.8× |
| transform | transform | T200_L20_S5 | 1.1× | 1.1× | 5.1× | 1.6× |
Minimum times at revision d41af96e.
Reverse-mode gradients gain most, because the package's own adjoints replace differentiating the loop. The forward run and ForwardDiff use no adjoints, so they are near the loop's speed and slower than it on several models. The package is slower than the loop in these cases:
slower_cases()Forward run: backend delay (0.97×), vaccination (0.68×), reproduction number (0.62×), occupancy (0.56×), latent processes (0.93×), time-varying delays (0.88×).
ForwardDiff: renewal (0.85×), vaccination (0.94×), forecasting (0.83×), reproduction number (0.97×), spatial strata (0.98×), occupancy (0.82×), latent processes (0.84×), time-varying delays (0.76×).
Mooncake: occupancy (0.98×).
Enzyme: imports (0.79×), latent processes (0.84×).
Issue #417 tracks the slower cases and issue #506 forward-mode adjoints.
The second table compares the package's Mooncake gradient with Mooncake on the same loop given hand-written Mooncake adjoints:
performance_table(; reference = :hand_rules)| Block | Case | Size | Mooncake |
|---|---|---|---|
| naive vs package | overview | T200_L20_S3 | 1.4× |
| backend renewal | bvd_renewal | T400_L60_S1 | 1.2× |
| backend patches | bvd_patches | T400_L60_S11 | 1.7× |
| backend delay | bvd_delay | T400_L60_S1 | 1.3× |
| renewal | renewal_depletion | T200_L20_S1 | 1.2× |
| vaccination | strata_waning | T200_L20_S1 | 0.9× |
| imports | renewal_imports | T200_L20_S1 | 1.1× |
| clinical outcomes | outcome_chain | T200_L20_S1 | 1.4× |
| forecasting | renewal_forecast | T200_L20_S1 | 1.0× |
| reproduction number | reproduction | T200_L20_S3 | 0.8× |
| spatial strata | strata_routes | T200_L20_S5 | 1.2× |
| occupancy | ward_flows | T200_L20_S1 | 0.8× |
| latent processes | ar | T200_L20_S1 | 1.4× |
| time-varying delays | delay_primary | T200_L15_S1 | 1.6× |
| transform | transform | T200_L20_S5 | 0.9× |
Minimum times at revision d41af96e.
The performance summary gives each example its own table, with the package's times and the gain from its rules. Each row names its case in test/ADFixtures/src/matrix_cases.jl, timed at the docs tier, and task -t benchmark/Taskfile.yml matrix-docs regenerates benchmark/results/docs.csv, which these tables read. The AD comparison times the gradient of every scenario in the AD test registry on each backend.
The suite
ComposableRecurrences benchmarks its core operations to track performance over time.
The "AD gradients" group times the gradient of each scenario in the package's AD test registry on each backend the package targets: ForwardDiff, and Enzyme and Mooncake in forward and reverse mode. The AD tests also run ReverseDiff, but the suite does not time it. Scenarios declared broken or skipped for a backend are left out of that backend's rows. The "Evaluation" group times the forward run of each benchmark matrix case at its CI size. Each matrix case also has gradient rows on the reverse-mode backends, once as users call the operator and once, prefixed "NoAdjoint", with any hand-written adjoint bypassed.
Each entry takes one evaluation per sample for up to a second, so a single history point is indicative rather than exact.
Run the suite locally with julia --project=benchmark benchmark/run.jl.