From 34d729da3f071121fe705bb155803e4561a0b4d7 Mon Sep 17 00:00:00 2001 From: ChrisRackauckas-Claude Date: Fri, 11 Sep 2026 17:58:22 -0400 Subject: [PATCH] Add AirspeedVelocity benchmarking CI Adds a benchmark workflow (Julia 1 and lts) and a benchmark/benchmarks.jl suite covering representative workloads so PRs check for performance regressions. Co-Authored-By: Chris Rackauckas Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Agent-Harness: devin 3000.10.21 (611c1cba) Agent-Model: SWE-2 High Agent-Session: local session transcript /home/crackauc/sandbox/tmp_20260911_112052_59120/history_6a789c0b69c64ca3.md --- .github/workflows/benchmark.yml | 29 +++++++++++++++++++++ benchmark/benchmarks.jl | 46 +++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 .github/workflows/benchmark.yml create mode 100644 benchmark/benchmarks.jl diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml new file mode 100644 index 0000000..750b967 --- /dev/null +++ b/.github/workflows/benchmark.yml @@ -0,0 +1,29 @@ +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: 30 + 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 new file mode 100644 index 0000000..1a7bcb8 --- /dev/null +++ b/benchmark/benchmarks.jl @@ -0,0 +1,46 @@ +using ODEInterfaceDiffEq, BenchmarkTools + +const SUITE = BenchmarkGroup() + +function lorenz!(du, u, p, t) + du[1] = 10.0 * (u[2] - u[1]) + du[2] = u[1] * (28.0 - u[3]) - u[2] + du[3] = u[1] * u[2] - (8 / 3) * u[3] + return nothing +end +prob = ODEProblem(lorenz!, [1.0, 0.0, 0.0], (0.0, 50.0)) + +# Stiff problem +function rober!(du, u, p, t) + du[1] = -0.04u[1] + 1.0e4 * u[2] * u[3] + du[2] = 0.04u[1] - 1.0e4 * u[2] * u[3] - 3.0e7 * u[2]^2 + du[3] = 3.0e7 * u[2]^2 + return nothing +end +prob_stiff = ODEProblem(rober!, [1.0, 0.0, 0.0], (0.0, 1.0e5)) + +# ============================================================================= +# Non-stiff solvers +# ============================================================================= + +SUITE["nonstiff"] = BenchmarkGroup() + +SUITE["nonstiff"]["dopri5"] = @benchmarkable solve($prob, dopri5()) +SUITE["nonstiff"]["dop853"] = @benchmarkable solve($prob, dop853()) +SUITE["nonstiff"]["odex"] = @benchmarkable solve($prob, odex()) + +# ============================================================================= +# Stiff solvers +# ============================================================================= + +SUITE["stiff"] = BenchmarkGroup() + +SUITE["stiff"]["radau5"] = @benchmarkable solve( + $prob_stiff, radau5(); saveat = 1.0e3 +) +SUITE["stiff"]["rodas"] = @benchmarkable solve( + $prob_stiff, rodas(); saveat = 1.0e3 +) +SUITE["stiff"]["seulex"] = @benchmarkable solve( + $prob_stiff, seulex(); saveat = 1.0e3 +)