Skip to content

Commit c2ef597

Browse files
paldayararslan
andauthored
Add benchmark GHA (#79)
* benchmark CI --------- Co-authored-by: Alex Arslan <[email protected]>
1 parent 94dc947 commit c2ef597

File tree

3 files changed

+69
-0
lines changed

3 files changed

+69
-0
lines changed

.github/workflows/benchmark.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: benchmarks
2+
concurrency:
3+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
4+
cancel-in-progress: true
5+
on:
6+
pull_request:
7+
branches:
8+
- master
9+
- main
10+
paths-ignore:
11+
- 'LICENSE.md'
12+
- 'README.md'
13+
- 'docs/**'
14+
- 'format/**'
15+
- 'test/**'
16+
jobs:
17+
benchmarks:
18+
runs-on: ubuntu-latest
19+
strategy:
20+
fail-fast: false
21+
steps:
22+
- uses: actions/checkout@v3
23+
- uses: julia-actions/setup-julia@v1
24+
with:
25+
version: "1"
26+
- uses: julia-actions/cache@v1
27+
- uses: julia-actions/julia-buildpkg@v1
28+
- name: Benchmark
29+
run: |
30+
git fetch origin +:refs/remotes/origin/HEAD
31+
julia --project=benchmark/ -e '
32+
using Pkg
33+
Pkg.develop(PackageSpec(path=pwd()))
34+
Pkg.instantiate()'
35+
# Pkg.update() allows us to benchmark even when dependencies/compat requirements change
36+
julia --project=benchmark/ -e '
37+
using PkgBenchmark, Loess
38+
juliacmd = `$(Base.julia_cmd()) -O3 -e "using Pkg; Pkg.update()"`
39+
config = BenchmarkConfig(; id="origin/HEAD", juliacmd)
40+
export_markdown(stdout, judge(Loess, config; verbose=true))'

benchmark/Project.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[deps]
2+
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
3+
Loess = "4345ca2d-374a-55d4-8d30-97f9976e7612"
4+
PkgBenchmark = "32113eaa-f34f-5b0d-bd6c-c81e245fc73d"
5+
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
6+
7+
[compat]
8+
BenchmarkTools = "1"
9+
PkgBenchmark = "0.2"
10+
julia = "1"

benchmark/benchmarks.jl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using BenchmarkTools, Loess, Random
2+
3+
const SUITE = BenchmarkGroup()
4+
5+
SUITE["random"] = BenchmarkGroup()
6+
7+
for i in 2:6
8+
n = 10^i
9+
x = rand(MersenneTwister(42), n)
10+
y = sqrt.(x)
11+
SUITE["random"][string(n)] = @benchmarkable loess($x, $y)
12+
end
13+
14+
SUITE["ties"] = BenchmarkGroup()
15+
let
16+
x = repeat([π/4*i for i in -20:20], inner=101)
17+
y = sin.(x)
18+
SUITE["ties"]["sine"] = @benchmarkable loess($x, $y; span=0.2)
19+
end

0 commit comments

Comments
 (0)