File tree Expand file tree Collapse file tree 4 files changed +76
-0
lines changed
Expand file tree Collapse file tree 4 files changed +76
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Run benchmarks
2+ on :
3+ pull_request :
4+ # Only trigger the benchmark job when you add `run benchmark` label to the PR
5+ types : [labeled, opened, synchronize, reopened]
6+ concurrency :
7+ # Skip intermediate builds: always.
8+ # Cancel intermediate builds: only if it is a pull request build.
9+ group : ${{ github.workflow }}-${{ github.ref }}
10+ cancel-in-progress : ${{ startsWith(github.ref, 'refs/pull/') }}
11+ jobs :
12+ Benchmark :
13+ runs-on : ubuntu-latest
14+ permissions :
15+ pull-requests : write
16+ actions : write # needed to allow julia-actions/cache to proactively delete old caches that it has created
17+ contents : read
18+ if : contains(github.event.pull_request.labels.*.name, 'benchmark')
19+ steps :
20+ - uses : actions/checkout@v4
21+ - uses : julia-actions/setup-julia@latest
22+ - name : Cache artifacts
23+ uses : actions/cache@v4
24+ env :
25+ cache-name : cache-artifacts
26+ with :
27+ path : ~/.julia/artifacts
28+ key : ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
29+ restore-keys : |
30+ ${{ runner.os }}-test-${{ env.cache-name }}-
31+ ${{ runner.os }}-test-
32+ ${{ runner.os }}-
33+ - name : Install dependencies
34+ run : julia -e 'using Pkg; pkg"add JSON PkgBenchmark BenchmarkCI@0.1"'
35+ - name : Run benchmarks
36+ run : julia benchmark/run_benchmarks.jl
37+ env :
38+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change @@ -6,3 +6,4 @@ LocalPreferences.toml
66* .cov
77docs /Manifest.toml
88lcov.info
9+ benchmark /Manifest.toml
Original file line number Diff line number Diff line change 1+ [deps ]
2+ BenchmarkTools = " 6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
3+ DAQP = " c47d62df-3981-49c8-9651-128b1cd08617"
4+ FiniteDiff = " 6a86dc24-6348-571c-b903-95158fe2bd41"
5+ Ipopt = " b6b21f68-93f8-5de0-b562-5493be1d77c9"
6+ JuMP = " 4076af6c-e467-56ae-b986-b466b2749572"
7+ LinearAlgebra = " 37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
8+ MadNLP = " 2621e9c9-9eb4-46b1-8089-e8c72242dfb6"
9+ ModelPredictiveControl = " 61f9bdb8-6ae4-484a-811f-bbf86720c31c"
10+ SparseArrays = " 2f01184e-e22b-5df5-ae63-d93ebab69eaf"
11+ SparseConnectivityTracer = " 9f842d2f-2579-4b1d-911e-f412cf18a3f5"
12+ SparseMatrixColorings = " 0a514795-09f3-496d-8182-132a7b665d35"
Original file line number Diff line number Diff line change 1+ using BenchmarkTools
2+ using Random
3+
4+ const SUITE = BenchmarkGroup ()
5+
6+ SUITE[" utf8" ] = BenchmarkGroup ([" string" , " unicode" ])
7+ teststr = String (join (rand (MersenneTwister (1 ), ' a' :' d' , 10 ^ 4 )))
8+ SUITE[" utf8" ][" replace" ] = @benchmarkable replace ($ teststr, " a" => " b" )
9+ SUITE[" utf8" ][" join" ] = @benchmarkable join ($ teststr, $ teststr)
10+ SUITE[" utf8" ][" plots" ] = BenchmarkGroup ()
11+
12+ SUITE[" trigonometry" ] = BenchmarkGroup ([" math" , " triangles" ])
13+ SUITE[" trigonometry" ][" circular" ] = BenchmarkGroup ()
14+ for f in (sin, cos, tan)
15+ for x in (0.0 , pi )
16+ SUITE[" trigonometry" ][" circular" ][string (f), x] = @benchmarkable ($ f)($ x)
17+ end
18+ end
19+
20+ SUITE[" trigonometry" ][" hyperbolic" ] = BenchmarkGroup ()
21+ for f in (sin, cos, tan)
22+ for x in (0.0 , pi )
23+ SUITE[" trigonometry" ][" hyperbolic" ][string (f), x] = @benchmarkable ($ f)($ x)
24+ end
25+ end
You can’t perform that action at this time.
0 commit comments