Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -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
31 changes: 31 additions & 0 deletions benchmark/benchmarks.jl
Original file line number Diff line number Diff line change
@@ -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
)
Loading