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..9ca1615 --- /dev/null +++ b/benchmark/benchmarks.jl @@ -0,0 +1,41 @@ +using Pkg +# Monorepo: the libraries live in lib/ — develop them so we benchmark this +# checkout's code, not the registered versions. +for lib in ( + "ODEProblemLibrary", "DAEProblemLibrary", "DDEProblemLibrary", + "SDEProblemLibrary", "JumpProblemLibrary", "BVProblemLibrary", + "NonlinearProblemLibrary", + ) + Pkg.develop(path = joinpath(@__DIR__, "..", "lib", lib)) +end + +using ODEProblemLibrary, DAEProblemLibrary, NonlinearProblemLibrary +using BVProblemLibrary +using BenchmarkTools + +const SUITE = BenchmarkGroup() + +# ============================================================================= +# Problem library loading (the package's job: constructing problems) +# ============================================================================= + +SUITE["ode"] = BenchmarkGroup() + +SUITE["ode"]["vanderpol"] = @benchmarkable ODEProblemLibrary.prob_ode_vanderpol +SUITE["ode"]["lorenz"] = @benchmarkable ODEProblemLibrary.prob_ode_lorenz +SUITE["ode"]["rober"] = @benchmarkable ODEProblemLibrary.prob_ode_rober +SUITE["ode"]["brusselator_1d"] = @benchmarkable ODEProblemLibrary.prob_ode_brusselator_1d +SUITE["ode"]["pleiades"] = @benchmarkable ODEProblemLibrary.prob_ode_pleiades +SUITE["ode"]["hires"] = @benchmarkable ODEProblemLibrary.prob_ode_hires + +SUITE["dae"] = BenchmarkGroup() + +SUITE["dae"]["resrob"] = @benchmarkable DAEProblemLibrary.prob_dae_resrob + +SUITE["nonlinear"] = BenchmarkGroup() + +SUITE["nonlinear"]["testcase_lookup"] = @benchmarkable NonlinearProblemLibrary.nlprob_23_testcases["Generalized Rosenbrock function"] + +SUITE["bvp"] = BenchmarkGroup() + +SUITE["bvp"]["linear_1"] = @benchmarkable BVProblemLibrary.prob_bvp_linear_1