Skip to content

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.

SuiteMedian ratioTrendStatus
AD gradients3.84↗⚠ reg
Convolution body3.01↗⚠ reg
Evaluation0.49↘ok
time_to_load5.11↗⚠ reg

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 3 revisions, columns labelled by commit date.

AD gradients ​

Time ​

Benchmarkv0.1.02026-11-30v0.1.0 / 4b4bc8cfd453de...
Matrix bvd_renewal_call T200_L20_S1/Enzyme reverse0.0521 ± 0.0094 ms18.5 ± 5.2 μs2.82 ± 0.94
Matrix bvd_renewal_call T200_L20_S1/ForwardDiff1.4 ± 0.032 ms0.559 ± 0.017 ms2.5 ± 0.095
Matrix bvd_renewal_call T200_L20_S1/Mooncake reverse0.0747 ± 0.014 ms23.5 ± 6.6 μs3.19 ± 1.1
Matrix conv_fixed T200_L20_S1/Enzyme reverse12.1 ± 2.9 μs2.63 ± 2.7 μs4.61 ± 4.9
Matrix conv_fixed T200_L20_S1/ForwardDiff0.823 ± 0.016 ms0.232 ± 0.016 ms3.54 ± 0.26
Matrix conv_fixed T200_L20_S1/Mooncake reverse0.0364 ± 0.015 ms9.18 ± 1.5 μs3.96 ± 1.7
Matrix delay_fixed T200_L20_S1/Enzyme reverse10.4 ± 2.4 μs4.69 ± 3.3 μs2.22 ± 1.7
Matrix delay_fixed T200_L20_S1/ForwardDiff0.922 ± 0.033 ms0.265 ± 0.01 ms3.47 ± 0.19
Matrix delay_fixed T200_L20_S1/Mooncake reverse24 ± 1.2 μs9 ± 2 μs2.67 ± 0.6
Matrix overview T200_L20_S3/Enzyme reverse0.261 ± 0.037 ms31 ± 17 μs8.41 ± 4.7
Matrix overview T200_L20_S3/ForwardDiff14.7 ± 2.6 ms1.89 ± 0.073 ms7.77 ± 1.4
Matrix overview T200_L20_S3/Mooncake reverse0.287 ± 0.026 ms0.0427 ± 0.0016 ms6.71 ± 0.66
Matrix random_walk T30_L1_S1/Enzyme reverse3.06 ± 0.48 μs0.131 ± 0.011 μs23.3 ± 4.2
Matrix random_walk T30_L1_S1/ForwardDiff5.66 ± 1.4 μs3.08 ± 0.59 μs1.84 ± 0.57
Matrix random_walk T30_L1_S1/Mooncake reverse8.02 ± 0.99 μs0.651 ± 0.03 μs12.3 ± 1.6
Matrix renewal T200_L20_S1/Enzyme reverse27 ± 6.1 μs6.58 ± 4.2 μs4.11 ± 2.8
Matrix renewal T200_L20_S1/ForwardDiff1.08 ± 0.031 ms0.37 ± 0.016 ms2.92 ± 0.15
Matrix renewal T200_L20_S1/Mooncake reverse0.046 ± 0.013 ms13.1 ± 4.4 μs3.51 ± 1.5
Matrix strata_mixing T200_L20_S5/Enzyme reverse0.38 ± 0.048 ms0.0481 ± 0.018 ms7.89 ± 3.1
Matrix strata_mixing T200_L20_S5/ForwardDiff0.0317 ± 0.0025 s9.92 ± 1.9 ms3.19 ± 0.66
Matrix strata_mixing T200_L20_S5/Mooncake reverse0.359 ± 0.029 ms0.0698 ± 0.0057 ms5.14 ± 0.59
Matrix bvd_patches_call T200_L20_S1/ForwardDiff1.03 ± 0.074 ms
Matrix bvd_patch T200_L20_S5/Mooncake reverse0.0874 ± 0.0041 ms
Matrix tv_piecewise_secondary_k5 T200_L20_S1/Mooncake reverse17.5 ± 2.8 μs
Matrix bvd_patches_call T200_L20_S1/Mooncake reverse0.0395 ± 0.0013 ms
Matrix tv_piecewise_renewal_primary_k5 T200_L20_S1/ForwardDiff0.484 ± 0.026 ms
Matrix tv_piecewise_renewal_secondary_k5 T200_L20_S1/ForwardDiff0.633 ± 0.027 ms
Matrix tv_piecewise_renewal_primary_k5 T200_L20_S1/Mooncake reverse23.4 ± 6.4 μs
Matrix bvd_patches_call T200_L20_S1/Enzyme reverse30 ± 1.1 μs
Matrix bvd_patches_call T200_L20_S5/Mooncake reverse0.113 ± 0.006 ms
Matrix tv_piecewise_secondary_k5 T200_L20_S1/Enzyme reverse11.9 ± 4.5 μs
Matrix tv_piecewise_primary_k5 T200_L20_S1/Mooncake reverse18 ± 2.7 μs
Matrix tv_piecewise_renewal_secondary_k5 T200_L20_S1/Enzyme reverse15.6 ± 6.1 μs
Matrix bvd_patches_call T200_L20_S5/Enzyme reverse0.0848 ± 0.0046 ms
Matrix tv_piecewise_primary_k5 T200_L20_S1/ForwardDiff0.44 ± 0.024 ms
Matrix bvd_patch T200_L20_S5/Enzyme reverse0.0668 ± 0.0063 ms
Matrix tv_piecewise_secondary_k5 T200_L20_S1/ForwardDiff0.442 ± 0.024 ms
Matrix bvd_patch T200_L20_S5/ForwardDiff11 ± 2.1 ms
Matrix tv_piecewise_primary_k5 T200_L20_S1/Enzyme reverse11.7 ± 5.3 μs
Matrix tv_piecewise_renewal_primary_k5 T200_L20_S1/Enzyme reverse18.8 ± 4.4 μs
Matrix bvd_patches_call T200_L20_S5/ForwardDiff30.5 ± 2 ms
Matrix tv_piecewise_renewal_secondary_k5 T200_L20_S1/Mooncake reverse22.1 ± 3.9 μs

Memory ​

Benchmarkv0.1.02026-11-30v0.1.0 / 4b4bc8cfd453de...
Matrix bvd_renewal_call T200_L20_S1/Enzyme reverse0.118 k allocs: 0.0363 MB0.053 k allocs: 28.5 kB1.31
Matrix bvd_renewal_call T200_L20_S1/ForwardDiff0.949 k allocs: 2.53 MB0.465 k allocs: 2.03 MB1.25
Matrix bvd_renewal_call T200_L20_S1/Mooncake reverse1.91 k allocs: 0.0821 MB0.057 k allocs: 0.0325 MB2.53
Matrix conv_fixed T200_L20_S1/Enzyme reverse0.046 k allocs: 25.8 kB29 allocs: 14.4 kB1.78
Matrix conv_fixed T200_L20_S1/ForwardDiff0.344 k allocs: 1.93 MB0.23 k allocs: 1.18 MB1.64
Matrix conv_fixed T200_L20_S1/Mooncake reverse0.328 k allocs: 0.062 MB0.036 k allocs: 18.5 kB3.43
Matrix delay_fixed T200_L20_S1/Enzyme reverse0.044 k allocs: 23.1 kB24 allocs: 16 kB1.44
Matrix delay_fixed T200_L20_S1/ForwardDiff0.302 k allocs: 1.68 MB0.182 k allocs: 0.842 MB1.99
Matrix delay_fixed T200_L20_S1/Mooncake reverse0.328 k allocs: 0.0566 MB24 allocs: 15.9 kB3.64
Matrix overview T200_L20_S3/Enzyme reverse1.51 k allocs: 0.235 MB0.091 k allocs: 0.074 MB3.18
Matrix overview T200_L20_S3/ForwardDiff2.71 k allocs: 24.9 MB1.05 k allocs: 9.33 MB2.66
Matrix overview T200_L20_S3/Mooncake reverse5.84 k allocs: 0.353 MB0.078 k allocs: 0.0695 MB5.08
Matrix random_walk T30_L1_S1/Enzyme reverse0.033 k allocs: 4.02 kB9 allocs: 1.47 kB2.73
Matrix random_walk T30_L1_S1/ForwardDiff0.056 k allocs: 28.6 kB20 allocs: 17.6 kB1.63
Matrix random_walk T30_L1_S1/Mooncake reverse0.327 k allocs: 11.7 kB14 allocs: 1.86 kB6.31
Matrix renewal T200_L20_S1/Enzyme reverse0.043 k allocs: 26.8 kB31 allocs: 20.1 kB1.33
Matrix renewal T200_L20_S1/ForwardDiff0.522 k allocs: 1.77 MB0.322 k allocs: 1.32 MB1.34
Matrix renewal T200_L20_S1/Mooncake reverse1.7 k allocs: 0.0669 MB0.034 k allocs: 19.8 kB3.45
Matrix strata_mixing T200_L20_S5/Enzyme reverse1.35 k allocs: 0.267 MB0.083 k allocs: 0.134 MB1.99
Matrix strata_mixing T200_L20_S5/ForwardDiff3.46 k allocs: 0.0507 GB2.31 k allocs: 30.9 MB1.68
Matrix strata_mixing T200_L20_S5/Mooncake reverse8.37 k allocs: 0.35 MB0.133 k allocs: 0.12 MB2.92
Matrix bvd_patches_call T200_L20_S1/ForwardDiff1.93 k allocs: 7.91 MB
Matrix bvd_patch T200_L20_S5/Mooncake reverse0.158 k allocs: 0.129 MB
Matrix tv_piecewise_secondary_k5 T200_L20_S1/Mooncake reverse0.089 k allocs: 0.035 MB
Matrix bvd_patches_call T200_L20_S1/Mooncake reverse0.173 k allocs: 0.0602 MB
Matrix tv_piecewise_renewal_primary_k5 T200_L20_S1/ForwardDiff1.52 k allocs: 2.54 MB
Matrix tv_piecewise_renewal_secondary_k5 T200_L20_S1/ForwardDiff1.52 k allocs: 2.65 MB
Matrix tv_piecewise_renewal_primary_k5 T200_L20_S1/Mooncake reverse0.118 k allocs: 0.0369 MB
Matrix bvd_patches_call T200_L20_S1/Enzyme reverse0.136 k allocs: 0.0636 MB
Matrix bvd_patches_call T200_L20_S5/Mooncake reverse0.196 k allocs: 0.262 MB
Matrix tv_piecewise_secondary_k5 T200_L20_S1/Enzyme reverse0.077 k allocs: 26.8 kB
Matrix tv_piecewise_primary_k5 T200_L20_S1/Mooncake reverse0.089 k allocs: 0.035 MB
Matrix tv_piecewise_renewal_secondary_k5 T200_L20_S1/Enzyme reverse0.105 k allocs: 29.9 kB
Matrix bvd_patches_call T200_L20_S5/Enzyme reverse0.156 k allocs: 0.288 MB
Matrix tv_piecewise_primary_k5 T200_L20_S1/ForwardDiff0.953 k allocs: 2.76 MB
Matrix bvd_patch T200_L20_S5/Enzyme reverse0.119 k allocs: 0.135 MB
Matrix tv_piecewise_secondary_k5 T200_L20_S1/ForwardDiff0.953 k allocs: 2.76 MB
Matrix bvd_patch T200_L20_S5/ForwardDiff3.36 k allocs: 31.4 MB
Matrix tv_piecewise_primary_k5 T200_L20_S1/Enzyme reverse0.077 k allocs: 26.8 kB
Matrix tv_piecewise_renewal_primary_k5 T200_L20_S1/Enzyme reverse0.105 k allocs: 28.9 kB
Matrix bvd_patches_call T200_L20_S5/ForwardDiff9.21 k allocs: 0.182 GB
Matrix tv_piecewise_renewal_secondary_k5 T200_L20_S1/Mooncake reverse0.118 k allocs: 0.0386 MB

Convolution body ​

Time ​

Benchmarkv0.1.02026-11-30v0.1.0 / 4b4bc8cfd453de...
BLAS axpy per lag0.439 ± 0.0012 μs0.35 ± 0.0015 μs1.25 ± 0.0064
native axpy per lag0.338 ± 0.0029 μs0.256 ± 0.0019 μs1.32 ± 0.015
package0.44 ± 0.0019 μs0.168 ± 0.0005 μs2.62 ± 0.014

Memory ​

Benchmarkv0.1.02026-11-30v0.1.0 / 4b4bc8cfd453de...
BLAS axpy per lag0 allocs: 0 B0 allocs: 0 B
native axpy per lag0 allocs: 0 B0 allocs: 0 B
package0 allocs: 0 B0 allocs: 0 B

Evaluation ​

Time ​

Benchmarkv0.1.02026-11-30v0.1.0 / 4b4bc8cfd453de...
Matrix bvd_renewal_call T200_L20_S19.64 ± 2.3 μs5.92 ± 2.2 μs1.63 ± 0.73
Matrix conv_fixed T200_L20_S11.32 ± 1.8 μs1.56 ± 0.3 μs0.846 ± 1.1
Matrix delay_fixed T200_L20_S12.75 ± 1.1 μs0.871 ± 0.26 μs3.16 ± 1.6
Matrix overview T200_L20_S319.7 ± 1 μs10.8 ± 0.47 μs1.83 ± 0.12
Matrix random_walk T30_L1_S10.31 ± 0.23 μs0.06 ± 0.1 μs5.17 ± 9.4
Matrix renewal T200_L20_S13.73 ± 2 μs1.95 ± 0.24 μs1.91 ± 1.1
Matrix strata_mixing T200_L20_S523.4 ± 0.97 μs16.6 ± 1.2 μs1.41 ± 0.12
Matrix tv_piecewise_renewal_primary_k5 T200_L20_S14.5 ± 2.9 μs
Matrix tv_piecewise_secondary_k5 T200_L20_S12.04 ± 1.7 μs
Matrix bvd_patch T200_L20_S523.7 ± 6.3 μs
Matrix tv_piecewise_primary_k5 T200_L20_S13.72 ± 1.3 μs
Matrix tv_piecewise_renewal_secondary_k5 T200_L20_S14.96 ± 2.2 μs
Matrix bvd_patches_call T200_L20_S50.0325 ± 0.0014 ms
Matrix bvd_patches_call T200_L20_S114.1 ± 2.8 μs

Memory ​

Benchmarkv0.1.02026-11-30v0.1.0 / 4b4bc8cfd453de...
Matrix bvd_renewal_call T200_L20_S10.035 k allocs: 10.1 kB15 allocs: 7.73 kB1.31
Matrix conv_fixed T200_L20_S112 allocs: 8.38 kB9 allocs: 5.14 kB1.63
Matrix delay_fixed T200_L20_S110 allocs: 6.92 kB9 allocs: 5.33 kB1.3
Matrix overview T200_L20_S30.052 k allocs: 0.0399 MB22 allocs: 20.1 kB2.03
Matrix random_walk T30_L1_S115 allocs: 1.19 kB4 allocs: 0.594 kB2
Matrix renewal T200_L20_S119 allocs: 7.48 kB11 allocs: 5.53 kB1.35
Matrix strata_mixing T200_L20_S50.044 k allocs: 0.0432 MB23 allocs: 0.0331 MB1.3
Matrix tv_piecewise_renewal_primary_k5 T200_L20_S10.041 k allocs: 11.3 kB
Matrix tv_piecewise_secondary_k5 T200_L20_S127 allocs: 9.73 kB
Matrix bvd_patch T200_L20_S50.033 k allocs: 0.0338 MB
Matrix tv_piecewise_primary_k5 T200_L20_S127 allocs: 9.73 kB
Matrix tv_piecewise_renewal_secondary_k5 T200_L20_S10.041 k allocs: 11.7 kB
Matrix bvd_patches_call T200_L20_S50.046 k allocs: 0.0821 MB
Matrix bvd_patches_call T200_L20_S10.039 k allocs: 18 kB

time_to_load ​

Time ​

Benchmarkv0.1.02026-11-30v0.1.0 / 4b4bc8cfd453de...
time_to_load0.146 ± 0.001 s0.195 ± 0.0021 s0.746 ± 0.0097

Memory ​

Benchmarkv0.1.02026-11-30v0.1.0 / 4b4bc8cfd453de...
time_to_load0.2 k allocs: 11.8 kB0.2 k allocs: 11.8 kB1

Skipped & broken benchmarks ​

No known skipped or broken benchmarks.

Per-benchmark timelines ​

<details> <summary>Show 2 plots</summary>

plot_ComposableRecurrences_1.pngplot_ComposableRecurrences_2.png

</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.

julia
performance_table()
BlockCaseSizeForward runForwardDiffMooncakeEnzyme
naive vs packageoverviewT200_L20_S31.5×2.2×10.9×4.3×
backend renewalbvd_renewalT400_L60_S11.8×3.6×4.1×2.9×
backend patchesbvd_patchesT400_L60_S111.5×2.2×9.1×4.4×
backend delaybvd_delayT400_L60_S11.0×3.7×5.2×2.3×
renewalrenewal_depletionT200_L20_S11.4×0.8×4.0×1.7×
vaccinationstrata_waningT200_L20_S10.7×0.9×2.4×1.0×
importsrenewal_importsT200_L20_S11.2×1.0×2.7×0.8×
clinical outcomesoutcome_chainT200_L20_S12.2×1.4×6.5×5.0×
forecastingrenewal_forecastT200_L20_S12.1×0.8×4.5×1.8×
reproduction numberreproductionT200_L20_S30.6×1.0×3.9×1.2×
spatial stratastrata_routesT200_L20_S51.1×1.0×7.0×7.1×
occupancyward_flowsT200_L20_S10.6×0.8×1.0×2.2×
latent processesarT200_L20_S10.9×0.8×1.7×0.8×
time-varying delaysdelay_primaryT200_L15_S10.9×0.8×4.6×5.8×
transformtransformT200_L20_S51.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:

julia
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:

julia
performance_table(; reference = :hand_rules)
BlockCaseSizeMooncake
naive vs packageoverviewT200_L20_S31.4×
backend renewalbvd_renewalT400_L60_S11.2×
backend patchesbvd_patchesT400_L60_S111.7×
backend delaybvd_delayT400_L60_S11.3×
renewalrenewal_depletionT200_L20_S11.2×
vaccinationstrata_waningT200_L20_S10.9×
importsrenewal_importsT200_L20_S11.1×
clinical outcomesoutcome_chainT200_L20_S11.4×
forecastingrenewal_forecastT200_L20_S11.0×
reproduction numberreproductionT200_L20_S30.8×
spatial stratastrata_routesT200_L20_S51.2×
occupancyward_flowsT200_L20_S10.8×
latent processesarT200_L20_S11.4×
time-varying delaysdelay_primaryT200_L15_S11.6×
transformtransformT200_L20_S50.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.