From 3e25d6755fd9a567dd6b91ecb06438fdcc354609 Mon Sep 17 00:00:00 2001 From: Alexander Demin Date: Tue, 3 Nov 2026 22:53:47 +0100 Subject: [PATCH 1/7] rm new benchmark --- .github/workflows/PerformanceCheck.yml | 6 +++- .github/workflows/benchmark.yml | 29 ------------------ benchmark/benchmarks.jl | 42 -------------------------- 3 files changed, 5 insertions(+), 72 deletions(-) delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 benchmark/benchmarks.jl diff --git a/.github/workflows/PerformanceCheck.yml b/.github/workflows/PerformanceCheck.yml index f61db1d9e..2b93d2a43 100644 --- a/.github/workflows/PerformanceCheck.yml +++ b/.github/workflows/PerformanceCheck.yml @@ -1,6 +1,10 @@ name: Performance Check + on: - workflow_dispatch: + pull_request: + branches: [master] + paths-ignore: ['docs/**'] + jobs: build-and-benchmark: runs-on: ${{ matrix.os }} diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index a7303b11a..000000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Benchmark this PR - -on: - pull_request: - branches: [master] - paths-ignore: ['docs/**'] - -permissions: - pull-requests: write - contents: read - -jobs: - benchmark: - runs-on: ubuntu-latest - timeout-minutes: 60 - strategy: - fail-fast: false - matrix: - version: ["1", "lts"] - env: - # Force consistent Julia depot path for self-hosted runners - JULIA_DEPOT_PATH: ~/.julia - steps: - - uses: MilesCranmer/AirspeedVelocity.jl@action-v1 - with: - julia-version: ${{ matrix.version }} - script: "benchmark/benchmarks.jl" - extra-pkgs: "" - job-summary: true diff --git a/benchmark/benchmarks.jl b/benchmark/benchmarks.jl deleted file mode 100644 index a9fd5eb02..000000000 --- a/benchmark/benchmarks.jl +++ /dev/null @@ -1,42 +0,0 @@ -using StructuralIdentifiability, BenchmarkTools - -const SUITE = BenchmarkGroup() - -# ============================================================================= -# Model construction — linear compartment models -# ============================================================================= - -SUITE["construction"] = BenchmarkGroup() - -graph3 = [[2], [1, 3], [1, 2]] -graph4 = [[2, 4], [1, 3], [2, 4], [1, 3]] - -SUITE["construction"]["lincomp_3"] = @benchmarkable linear_compartment_model( - $graph3; inputs = [1], outputs = [1], leaks = [] -) -SUITE["construction"]["lincomp_4"] = @benchmarkable linear_compartment_model( - $graph4; inputs = [2], outputs = [1], leaks = [2, 3] -) - -# ============================================================================= -# Identifiability assessment — the core workload: differential algebra + -# rational function field computation -# ============================================================================= - -SUITE["identifiability"] = BenchmarkGroup() - -ode3 = linear_compartment_model(graph3; inputs = [1], outputs = [1]) -ode4 = linear_compartment_model(graph4; inputs = [2], outputs = [1], leaks = [2, 3]) - -SUITE["identifiability"]["local_3"] = @benchmarkable assess_local_identifiability($ode3) -SUITE["identifiability"]["local_4"] = @benchmarkable assess_local_identifiability($ode4) -SUITE["identifiability"]["global_3"] = @benchmarkable assess_identifiability($ode3) seconds = 600 - -# ============================================================================= -# IO-equation derivation and identifiable function extraction -# ============================================================================= - -SUITE["ioequations"] = BenchmarkGroup() - -SUITE["ioequations"]["find_3"] = @benchmarkable find_ioequations($ode3) -SUITE["ioequations"]["find_4"] = @benchmarkable find_ioequations($ode4) From 1d77e1973ac975109d76f4a626413dff52d781db Mon Sep 17 00:00:00 2001 From: Alexander Demin Date: Wed, 4 Nov 2026 17:40:05 +0100 Subject: [PATCH 2/7] fix benchmarks --- benchmarking/CI-scripts/Project.toml | 3 +++ benchmarking/CI-scripts/run_benchmarks.jl | 19 ++++++++++--------- benchmarking/CI-scripts/runtests.jl | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/benchmarking/CI-scripts/Project.toml b/benchmarking/CI-scripts/Project.toml index 2f6685d27..02f62dfcf 100644 --- a/benchmarking/CI-scripts/Project.toml +++ b/benchmarking/CI-scripts/Project.toml @@ -6,3 +6,6 @@ Nemo = "2edaba10-b0f1-5616-af89-8c11ac63239a" PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d" Primes = "27ebfcd6-29c5-5fa9-bf4b-fb8fc14df3ae" TestSetExtensions = "98d24dd4-01ad-11ea-1b02-c9a08f80db04" + +[compat] +PrettyTables = "3" diff --git a/benchmarking/CI-scripts/run_benchmarks.jl b/benchmarking/CI-scripts/run_benchmarks.jl index 3b04b3fae..a713056d4 100644 --- a/benchmarking/CI-scripts/run_benchmarks.jl +++ b/benchmarking/CI-scripts/run_benchmarks.jl @@ -8,8 +8,6 @@ stopwatch = time_ns() # TTFX t1 = @timed using StructuralIdentifiability -include("../benchmarks.jl") - suite = [] push!( @@ -17,6 +15,9 @@ push!( (problem_name = "using StructuralIdentifiability", type = :time, result = [t1.time]), ) +# Record the load time before @ODEmodel introduces model parameters such as t1. +include("../benchmarks.jl") + # Allocations # Coming soon @@ -54,8 +55,8 @@ function perform_operation( end fun_name = "assess_identifiability" -perform_operation(benchmarks[:LV_simple][:ode]) -for m in [:SIWR, :LV_simple, :Pharm] +perform_operation(benchmarks[:LV][:ode]) +for m in [:SIWR_orig, :LV, :Pharm] push!( suite, ( @@ -68,10 +69,10 @@ end fun_name = "assess_local_identifiability" perform_operation( - benchmarks[:LV_simple][:ode], + benchmarks[:LV][:ode], StructuralIdentifiability.assess_local_identifiability, ) -for m in [:SIWR, :Pharm, :MAPK5, :MAPK5bis, :Goodwin] +for m in [:SIWR_orig, :Pharm, :MAPK_5out, :MAPK_5out_bis, :Goodwin] push!( suite, ( @@ -87,10 +88,10 @@ end fun_name = "find_identifiable_functions" perform_operation( - benchmarks[:LV_simple][:ode], + benchmarks[:LV][:ode], StructuralIdentifiability.find_identifiable_functions, ) -for m in [:Goodwin, :SEAIJRC, :Sntg, :LLW, :Bilirubin] +for m in [:Goodwin, :SEAIJRC, :St, :LLW, :Bilirubin] push!( suite, ( @@ -106,7 +107,7 @@ end fun_name = "reparametrize_global" perform_operation( - benchmarks[:LV_simple][:ode], + benchmarks[:LV][:ode], StructuralIdentifiability.reparametrize_global, ) for m in [:Goodwin, :SEAIJRC, :SEUIR] diff --git a/benchmarking/CI-scripts/runtests.jl b/benchmarking/CI-scripts/runtests.jl index fd9f0325c..ba19034d1 100644 --- a/benchmarking/CI-scripts/runtests.jl +++ b/benchmarking/CI-scripts/runtests.jl @@ -181,7 +181,7 @@ function post(fail, table) println(io, "No regressions detected✅") end table_header = ["Problem", "Master", "This commit", "Result"] - pretty_table(io, table, header = table_header, alignment = [:l, :r, :r, :r]) + pretty_table(io, table, column_labels = table_header, alignment = [:l, :r, :r, :r]) comment_str = String(take!(io)) return println(comment_str) end From de49278b05060f746ca1c5cfb97efd2c52e2f45d Mon Sep 17 00:00:00 2001 From: Alexander Demin Date: Wed, 4 Nov 2026 20:16:12 +0100 Subject: [PATCH 3/7] do not crop table --- benchmarking/CI-scripts/runtests.jl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/benchmarking/CI-scripts/runtests.jl b/benchmarking/CI-scripts/runtests.jl index ba19034d1..a6345960a 100644 --- a/benchmarking/CI-scripts/runtests.jl +++ b/benchmarking/CI-scripts/runtests.jl @@ -181,7 +181,13 @@ function post(fail, table) println(io, "No regressions detected✅") end table_header = ["Problem", "Master", "This commit", "Result"] - pretty_table(io, table, column_labels = table_header, alignment = [:l, :r, :r, :r]) + pretty_table( + io, table, + column_labels = table_header, + alignment = [:l, :r, :r, :r], + fit_table_in_display_horizontally = false, + fit_table_in_display_vertically = false, + ) comment_str = String(take!(io)) return println(comment_str) end From 02d007e1d7e830b129a897489cfda44e244236bb Mon Sep 17 00:00:00 2001 From: Alexander Demin Date: Wed, 4 Nov 2026 22:15:53 +0100 Subject: [PATCH 4/7] run smaller benches more --- benchmarking/CI-scripts/run_benchmarks.jl | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/benchmarking/CI-scripts/run_benchmarks.jl b/benchmarking/CI-scripts/run_benchmarks.jl index a713056d4..0890531e0 100644 --- a/benchmarking/CI-scripts/run_benchmarks.jl +++ b/benchmarking/CI-scripts/run_benchmarks.jl @@ -56,13 +56,17 @@ end fun_name = "assess_identifiability" perform_operation(benchmarks[:LV][:ode]) -for m in [:SIWR_orig, :LV, :Pharm] +for (m, trials) in [(:SIWR_orig, 3), (:LV, 30), (:Pharm, 3)] push!( suite, ( problem_name = benchmarks[m][:name] * " " * fun_name, type = :time, - result = perform_operation(benchmarks[m][:ode]), + result = perform_operation( + benchmarks[m][:ode], + StructuralIdentifiability.assess_identifiability, + trials, + ), ), ) end @@ -72,7 +76,9 @@ perform_operation( benchmarks[:LV][:ode], StructuralIdentifiability.assess_local_identifiability, ) -for m in [:SIWR_orig, :Pharm, :MAPK_5out, :MAPK_5out_bis, :Goodwin] +for (m, trials) in [ + (:SIWR_orig, 30), (:Pharm, 30), (:MAPK_5out, 3), (:MAPK_5out_bis, 3), (:Goodwin, 30), + ] push!( suite, ( @@ -81,6 +87,7 @@ for m in [:SIWR_orig, :Pharm, :MAPK_5out, :MAPK_5out_bis, :Goodwin] result = perform_operation( benchmarks[m][:ode], StructuralIdentifiability.assess_local_identifiability, + trials, ), ), ) @@ -91,7 +98,9 @@ perform_operation( benchmarks[:LV][:ode], StructuralIdentifiability.find_identifiable_functions, ) -for m in [:Goodwin, :SEAIJRC, :St, :LLW, :Bilirubin] +for (m, trials) in [ + (:Goodwin, 30), (:SEAIJRC, 3), (:St, 3), (:LLW, 30), (:Bilirubin, 30), + ] push!( suite, ( @@ -100,6 +109,7 @@ for m in [:Goodwin, :SEAIJRC, :St, :LLW, :Bilirubin] result = perform_operation( benchmarks[m][:ode], StructuralIdentifiability.find_identifiable_functions, + trials, ), ), ) @@ -110,7 +120,7 @@ perform_operation( benchmarks[:LV][:ode], StructuralIdentifiability.reparametrize_global, ) -for m in [:Goodwin, :SEAIJRC, :SEUIR] +for (m, trials) in [(:Goodwin, 30), (:SEAIJRC, 3), (:SEUIR, 30)] push!( suite, ( @@ -119,6 +129,7 @@ for m in [:Goodwin, :SEAIJRC, :SEUIR] result = perform_operation( benchmarks[m][:ode], StructuralIdentifiability.reparametrize_global, + trials, ), ), ) From b7c7c2dba6b5dbb9fb1b0e92c9b8a6eec591045d Mon Sep 17 00:00:00 2001 From: Alexander Demin Date: Fri, 6 Nov 2026 21:32:26 +0100 Subject: [PATCH 5/7] no logging in CI benchmarks --- benchmarking/CI-scripts/run_benchmarks.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/benchmarking/CI-scripts/run_benchmarks.jl b/benchmarking/CI-scripts/run_benchmarks.jl index 0890531e0..473e0bdf6 100644 --- a/benchmarking/CI-scripts/run_benchmarks.jl +++ b/benchmarking/CI-scripts/run_benchmarks.jl @@ -24,6 +24,7 @@ include("../benchmarks.jl") # Runtime import Primes import Nemo +using Logging function nemo_make_prime_finite_field(p) return if p < typemax(UInt) @@ -48,7 +49,7 @@ function perform_operation( times = [] for _ in 1:trials GC.gc() - time = @elapsed fun(ode; kws...) + time = @elapsed fun(ode; loglevel=Logging.Error, kws...) push!(times, time) end return times From 202a3d54d25ade072ad26c9542866274689af202 Mon Sep 17 00:00:00 2001 From: Alexander Demin <60229118+sumiya11@users.noreply.github.com> Date: Fri, 6 Nov 2026 21:37:00 +0100 Subject: [PATCH 6/7] Apply suggestion from @github-actions[bot] Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- benchmarking/CI-scripts/run_benchmarks.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmarking/CI-scripts/run_benchmarks.jl b/benchmarking/CI-scripts/run_benchmarks.jl index 473e0bdf6..ed227365f 100644 --- a/benchmarking/CI-scripts/run_benchmarks.jl +++ b/benchmarking/CI-scripts/run_benchmarks.jl @@ -49,7 +49,7 @@ function perform_operation( times = [] for _ in 1:trials GC.gc() - time = @elapsed fun(ode; loglevel=Logging.Error, kws...) + time = @elapsed fun(ode; loglevel = Logging.Error, kws...) push!(times, time) end return times From d26ab6a979c1a2234566832dc0c3c969e900caa3 Mon Sep 17 00:00:00 2001 From: Alexander Demin Date: Sat, 7 Nov 2026 00:11:25 +0100 Subject: [PATCH 7/7] medians!!! --- benchmarking/CI-scripts/runtests.jl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/benchmarking/CI-scripts/runtests.jl b/benchmarking/CI-scripts/runtests.jl index a6345960a..b91626f39 100644 --- a/benchmarking/CI-scripts/runtests.jl +++ b/benchmarking/CI-scripts/runtests.jl @@ -128,13 +128,11 @@ function compare() master = 1.0e9 .* master nightly = 1.0e9 .* nightly f, unit = best_unit(maximum(master)) - m1 = round(mean(master) / f, digits = 2) - d1 = round(std(master) / f, digits = 2) - label_master = "$m1 ± $d1 $unit" - m2 = round(mean(nightly) / f, digits = 2) - d2 = round(std(nightly) / f, digits = 2) - label_nightly = "$m2 ± $d2 $unit" - indicator = if mean(master) < 1.0e9 * IGNORE_SMALL + m1 = median(master) + label_master = "$(round(m1 / f, digits = 2)) $unit" + m2 = median(nightly) + label_nightly = "$(round(m2 / f, digits = 2)) $unit" + indicator = if m1 < 1.0e9 * IGNORE_SMALL 0, "insignificant" elseif (1 + MAX_DEVIATION) * m1 < m2 fail = true @@ -170,6 +168,8 @@ function post(fail, table) comment_header = """ ## Running times benchmark + Reported times are medians across all measurements. + Note, that these numbers may fluctuate on the CI servers, so take them with a grain of salt. """