From 3999b89b84b2d8a391e6a0d98c75626cb8627774 Mon Sep 17 00:00:00 2001 From: ChrisRackauckas-Claude Date: Sat, 12 Sep 2026 00:31:54 -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 Agent-Model: SWE-2 Max Agent-Session: local session transcript /home/crackauc/.local/share/devin/cli/summaries/history_ccb52064e6514b21.md --- .github/workflows/benchmark.yml | 29 +++++++++++++++++++++++++++++ benchmark/benchmarks.jl | 31 +++++++++++++++++++++++++++++++ 2 files changed, 60 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..2f82998 --- /dev/null +++ b/.github/workflows/benchmark.yml @@ -0,0 +1,29 @@ +name: Benchmark this PR + +on: + pull_request: + branches: [main] + 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: "SparseArrays,StableRNGs" + job-summary: true diff --git a/benchmark/benchmarks.jl b/benchmark/benchmarks.jl new file mode 100644 index 0000000..0aa7266 --- /dev/null +++ b/benchmark/benchmarks.jl @@ -0,0 +1,31 @@ +using SparseMatrixIdentification, BenchmarkTools +using StableRNGs, SparseArrays + +const SUITE = BenchmarkGroup() +const rng = StableRNG(123) + +n = 2000 +A_sparse = sprand(rng, n, n, 0.005) +# Banded sparse matrix +A_band = spdiagm(-1 => rand(rng, n - 1), 0 => rand(rng, n), 2 => rand(rng, n - 2)) +# Block-banded +blk = 50 +A_blk = spdiagm( + -blk => rand(rng, n - blk), 0 => rand(rng, n), blk => rand(rng, n - blk) +) + +# ============================================================================= +# Structure detection +# ============================================================================= + +SUITE["detect"] = BenchmarkGroup() + +SUITE["detect"]["getstructure_sparse"] = @benchmarkable getstructure($A_sparse) +SUITE["detect"]["getstructure_banded"] = @benchmarkable getstructure($A_band) +SUITE["detect"]["getstructure_blockbanded"] = @benchmarkable getstructure($A_blk) +SUITE["detect"]["sparsestructure"] = @benchmarkable sparsestructure( + $A_sparse, 0.5 +) +SUITE["detect"]["sparsestructure_dense"] = @benchmarkable sparsestructure( + $(sparse(rand(rng, 500, 500))), 0.5 +)