Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setup BenchmarkCI #148

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from 8 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
26 changes: 26 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Run benchmarks

on:
pull_request:

jobs:
Benchmark:
runs-on: ubuntu-latest
env:
JULIA_DEBUG: BenchmarkCI
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@latest
with:
version: 1.3
- name: Install dependencies
run: julia -e 'using Pkg; pkg"add PkgBenchmark https://github.com/tkf/BenchmarkCI.jl"'
- name: Run benchmarks
run: julia -e 'using BenchmarkCI; BenchmarkCI.judge(baseline = "HEAD")'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
run: julia -e 'using BenchmarkCI; BenchmarkCI.judge(baseline = "HEAD")'
run: julia -e 'using BenchmarkCI; BenchmarkCI.judge()'

baseline = "HEAD" should be removed before merging this.

env:
# Add project root directory `.` to the load path:
JULIA_LOAD_PATH: '@:.:'
- name: Post results
jw3126 marked this conversation as resolved.
Show resolved Hide resolved
run: julia -e "using BenchmarkCI; BenchmarkCI.postjudge()"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
*.jl.mem
docs/build
docs/site
Manifest.toml
/Manifest.toml
/.benchmarkci
/benchmark/*.json
1 change: 1 addition & 0 deletions benchmark/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/Manifest.toml
5 changes: 5 additions & 0 deletions benchmark/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[deps]
Copy link
Member

@johnnychen94 johnnychen94 Jan 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my first sight, it's not so intuitive where this file is used. I'm imagining something like this in the workflow

- julia -e 'using BenchmarkCI; BenchmarkCI.displayjudgement()'
+ julia --project=benchmark -e 'using BenchmarkCI; BenchmarkCI.displayjudgement()'

BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
ImageFiltering = "6a3955dd-da59-5b1f-98d4-e7296123deb5"
jw3126 marked this conversation as resolved.
Show resolved Hide resolved
PkgBenchmark = "32113eaa-f34f-5b0d-bd6c-c81e245fc73d"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
17 changes: 16 additions & 1 deletion benchmark/benchmarks.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
using ImageFiltering
using PkgBenchmark
using BenchmarkTools
using Statistics: quantile, mean, median!

include("mapwindow.jl")
SUITE = BenchmarkGroup()
SUITE["mapwindow"] = BenchmarkGroup()

let grp = SUITE["mapwindow"]
img1d = randn(1000)
img2d = randn(30,30)
img3d = randn(10,11,12)
grp["cheap f, tiny window"] = @benchmarkable mapwindow(first, $img1d, (1,))
grp["extrema"] = @benchmarkable mapwindow(extrema, $img2d, (5,5))
grp["median!"] = @benchmarkable mapwindow(median!, $img2d, (5,5))
grp["mean, small window"] = @benchmarkable mapwindow(mean, $img1d, (3,))
grp["mean, large window"] = @benchmarkable mapwindow(mean, $img3d, (5,5,5))
grp["expensive f"] = @benchmarkable mapwindow(x -> quantile(vec(x), 0.7), $img3d, (3,3,3))
end
11 changes: 0 additions & 11 deletions benchmark/mapwindow.jl

This file was deleted.