Skip to content

Commit 38878a0

Browse files
authored
perf: cibench workflow (#179)
* perf: cibench workflow * fixes * features build.rs interplay * fix * critcmp -t 5 (filter <5% deltas) * pr num before matrix feature * short sha
1 parent ab76284 commit 38878a0

File tree

1 file changed

+123
-0
lines changed

1 file changed

+123
-0
lines changed

.github/workflows/cibench.yml

+123
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
name: CI Benchmarks
2+
on:
3+
pull_request:
4+
branches: [master]
5+
6+
env:
7+
CARGO_TERM_COLOR: always
8+
RUSTFLAGS: "-C target-cpu=native"
9+
10+
jobs:
11+
benchmark:
12+
name: Run benchmarks
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Install Rust
20+
uses: actions-rs/toolchain@v1
21+
with:
22+
profile: minimal
23+
toolchain: stable
24+
override: true
25+
26+
- name: Install critcmp
27+
run: cargo install critcmp
28+
29+
- name: Run benchmarks (master)
30+
run: |
31+
git checkout master
32+
cargo bench --bench parse -- --save-baseline master
33+
34+
- name: Run benchmarks (PR)
35+
run: |
36+
git checkout ${{ github.event.pull_request.head.sha }}
37+
cargo bench --bench parse -- --save-baseline pr-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }}
38+
39+
- name: Compare benchmarks
40+
run: |
41+
critcmp -t 5 master pr-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }}
42+
43+
benchmark-x64:
44+
name: Run x64 benchmarks
45+
runs-on: ubuntu-latest
46+
strategy:
47+
matrix:
48+
feature: [swar, sse42, avx2]
49+
steps:
50+
- uses: actions/checkout@v3
51+
with:
52+
fetch-depth: 0
53+
54+
- name: Install Rust
55+
uses: actions-rs/toolchain@v1
56+
with:
57+
profile: minimal
58+
toolchain: stable
59+
override: true
60+
61+
- name: Install critcmp
62+
run: cargo install critcmp
63+
64+
- name: Run benchmarks (master)
65+
run: |
66+
git checkout master
67+
cargo bench --bench parse -- --save-baseline master-${{ matrix.feature }}
68+
env:
69+
CARGO_CFG_HTTPARSE_DISABLE_SIMD: ${{ matrix.feature == 'swar' && '1' || '0' }}
70+
RUSTFLAGS: ${{ matrix.feature != 'swar' && format('-C target-feature=+{0}', matrix.feature) || '' }}
71+
72+
- name: Run benchmarks (PR)
73+
run: |
74+
git checkout ${{ github.event.pull_request.head.sha }}
75+
cargo bench --bench parse -- --save-baseline pr-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }}-${{ matrix.feature }}
76+
env:
77+
CARGO_CFG_HTTPARSE_DISABLE_SIMD: ${{ matrix.feature == 'swar' && '1' || '0' }}
78+
RUSTFLAGS: ${{ matrix.feature != 'swar' && format('-C target-feature=+{0}', matrix.feature) || '' }}
79+
80+
- name: Compare benchmarks
81+
run: |
82+
critcmp -t 5 master-${{ matrix.feature }} pr-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }}-${{ matrix.feature }}
83+
84+
benchmark-aarch64:
85+
name: Run aarch64 benchmarks
86+
runs-on: macos-latest
87+
strategy:
88+
matrix:
89+
feature: [swar, neon]
90+
steps:
91+
- uses: actions/checkout@v3
92+
with:
93+
fetch-depth: 0
94+
95+
- name: Install Rust
96+
uses: actions-rs/toolchain@v1
97+
with:
98+
profile: minimal
99+
toolchain: stable
100+
override: true
101+
102+
- name: Install critcmp
103+
run: cargo install critcmp
104+
105+
- name: Run benchmarks (master)
106+
run: |
107+
git checkout master
108+
cargo bench --bench parse -- --save-baseline master-aarch64-${{ matrix.feature }}
109+
env:
110+
CARGO_CFG_HTTPARSE_DISABLE_SIMD: ${{ matrix.feature == 'swar' && '1' || '0' }}
111+
RUSTFLAGS: ${{ matrix.feature == 'neon' && '-C target-feature=+neon' || '' }}
112+
113+
- name: Run benchmarks (PR)
114+
run: |
115+
git checkout ${{ github.event.pull_request.head.sha }}
116+
cargo bench --bench parse -- --save-baseline pr-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }}-aarch64-${{ matrix.feature }}
117+
env:
118+
CARGO_CFG_HTTPARSE_DISABLE_SIMD: ${{ matrix.feature == 'swar' && '1' || '0' }}
119+
RUSTFLAGS: ${{ matrix.feature == 'neon' && '-C target-feature=+neon' || '' }}
120+
121+
- name: Compare benchmarks
122+
run: |
123+
critcmp -t 5 master-aarch64-${{ matrix.feature }} pr-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }}-aarch64-${{ matrix.feature }}

0 commit comments

Comments
 (0)