Skip to content

Commit c9926b3

Browse files
committed
Add benchmark CI
1 parent 4f9b542 commit c9926b3

3 files changed

Lines changed: 68 additions & 1 deletion

File tree

.github/workflows/Benchmark.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Benchmark
2+
on:
3+
push:
4+
branches:
5+
- main
6+
tags: ['*']
7+
8+
jobs:
9+
test:
10+
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
version:
16+
- '1.8'
17+
os:
18+
- ubuntu-latest
19+
arch:
20+
- x64
21+
steps:
22+
- uses: actions/checkout@v3
23+
- uses: julia-actions/setup-julia@v1
24+
with:
25+
version: ${{ matrix.version }}
26+
arch: ${{ matrix.arch }}
27+
- uses: julia-actions/cache@v1
28+
- uses: julia-actions/julia-buildpkg@v1
29+
- name: Install JuliaFormatter and format
30+
run: |
31+
julia -e 'using Pkg; Pkg.add(PackageSpec(name="PkgBenchmark"))'
32+
julia --project=benchmark -e 'using Pkg; Pkg.instantiate()'
33+
- run: |
34+
julia --project=benchmark -e '
35+
using PkgBenchmark, TaylorDiff
36+
include("benchmark/utils.jl")
37+
res = benchmarkpkg(TaylorDiff)
38+
upload(res)'

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<a href="https://juliadiff.org/TaylorDiff.jl/dev/"><img src="https://img.shields.io/badge/docs-dev-blue.svg" alt="Dev" /></a>
77
<a href="https://github.com/JuliaDiff/TaylorDiff.jl/actions/workflows/CI.yml?query=branch%3Amain"><img src="https://github.com/JuliaDiff/TaylorDiff.jl/actions/workflows/CI.yml/badge.svg?branch=main" alt="Build Status" /></a>
88
<a href="https://codecov.io/gh/JuliaDiff/TaylorDiff.jl"><img src="https://codecov.io/gh/JuliaDiff/TaylorDiff.jl/branch/main/graph/badge.svg?token=5KYP7K71VQ"/></a>
9+
<a href="https://benchmark.tansongchen.com/TaylorDiff.jl"><img src="https://github.com/JuliaDiff/TaylorDiff.jl/actions/workflows/Benchmark.yml/badge.svg?branch=main" alt="Benchmark Status" /></a>
910
<br />
1011
<a href="https://github.com/SciML/ColPrac"><img src="https://img.shields.io/badge/ColPrac-Contributor's%20Guide-blueviolet" alt="ColPrac: Contributor's Guide on Collaborative Practices for Community Packages" /></a>
1112
<a href="https://github.com/SciML/SciMLStyle"><img src="https://img.shields.io/static/v1?label=code%20style&message=SciML&color=9558b2&labelColor=389826" alt="SciML Code Style" /></a>
@@ -15,4 +16,4 @@
1516
<a href="https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=563952901&machine=standardLinux32gb&devcontainer_path=.devcontainer%2Fdevcontainer.json&location=EastUshttps://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=563952901&machine=standardLinux32gb&devcontainer_path=.devcontainer%2Fdevcontainer.json&location=EastUs"><img src="https://github.com/codespaces/badge.svg" alt="Open in GitHub Codespaces" /></a>
1617
</p>
1718

18-
Please see [Documentation](https://juliadiff.org/TaylorDiff.jl) for more information.
19+
Please see [Documentation](https://juliadiff.org/TaylorDiff.jl) and [Benchmarks](https://benchmark.tansongchen.com/TaylorDiff.jl) for more information.

benchmark/utils.jl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import JSON: lower, json
2+
using HTTP: put
3+
using BenchmarkTools
4+
using BenchmarkTools: Trial, TrialEstimate
5+
6+
function lower(results::BenchmarkResults)
7+
Dict("name" => results.name,
8+
"commit" => results.commit,
9+
"benchmarkgroup" => lower(results.benchmarkgroup),
10+
"date" => results.date,
11+
"julia_commit" => results.julia_commit,
12+
"vinfo" => results.vinfo,
13+
"benchmarkconfig" => results.benchmarkconfig)
14+
end
15+
16+
lower(group::BenchmarkGroup) = Dict(key => lower(value) for (key, value) in group.data)
17+
18+
lower(trial::Trial) = lower(median(trial))
19+
20+
function lower(te::TrialEstimate)
21+
Dict("time" => te.time,
22+
"memory" => te.memory,
23+
"allocs" => te.allocs)
24+
end
25+
26+
function upload(results::BenchmarkResults)
27+
put("https://benchmark.tansongchen.com/data?repo=TaylorDiff.jl"; body=json(results))
28+
end

0 commit comments

Comments
 (0)