Skip to content

Commit 4738d3f

Browse files
authored
Improve perf CI (#490)
1 parent 1c4e2ac commit 4738d3f

File tree

3 files changed

+24
-14
lines changed

3 files changed

+24
-14
lines changed

.github/scripts/run-benchmarks.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
# Performance benchmarking script
4+
# Usage: ./scripts/run-benchmarks.sh
5+
6+
set -e
7+
8+
echo "Running network filter matching benchmark..."
9+
cargo bench --bench bench_matching rule-match-browserlike/brave-list -- --output-format bencher
10+
11+
echo "Running first request matching delay benchmark..."
12+
cargo bench --bench bench_matching rule-match-first-request -- --output-format bencher
13+
14+
echo "Running startup speed benchmark..."
15+
cargo bench --bench bench_rules blocker_new/brave-list -- --output-format bencher
16+
17+
echo "Running memory usage benchmark..."
18+
cargo bench --bench bench_memory memory-usage -- --output-format bencher

.github/workflows/perf-ci.yml

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,12 @@ jobs:
2222
runs-on: ubuntu-latest
2323

2424
steps:
25-
- name: Checkout
25+
- name: Checkout PR
2626
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2727

28-
- name: Bench network filter matching
29-
run: cargo bench --bench bench_matching rule-match-browserlike/brave-list -- --output-format bencher | tee -a output.txt
30-
31-
- name: Bench first request matching delay
32-
run: cargo bench --bench bench_matching rule-match-first-request -- --output-format bencher | tee -a output.txt
33-
34-
- name: Bench startup speed
35-
run: cargo bench --bench bench_rules blocker_new/brave-list -- --output-format bencher | tee -a output.txt
36-
37-
- name: Bench memory usage
38-
run: cargo bench --bench bench_memory -- --output-format bencher | tee -a output.txt
28+
- name: Run benchmarks
29+
run: |
30+
./.github/scripts/run-benchmarks.sh | tee -a output.txt
3931
4032
- name: Store benchmark result
4133
uses: benchmark-action/github-action-benchmark@d48d326b4ca9ba73ca0cd0d59f108f9e02a381c7 # v1.20.4
@@ -44,7 +36,7 @@ jobs:
4436
tool: 'cargo'
4537
output-file-path: output.txt
4638
github-token: ${{ secrets.GITHUB_TOKEN }}
47-
alert-threshold: '130%' # fails on +30% regression
39+
alert-threshold: '110%' # fails on +10% regression
4840
comment-on-alert: true
4941
fail-on-alert: true
5042
comment-always: true

benches/bench_matching.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ fn rule_match_browserlike_comparable(c: &mut Criterion) {
212212
let requests_len = requests.len() as u64;
213213

214214
group.throughput(Throughput::Elements(requests_len));
215-
group.sample_size(20);
215+
group.sample_size(10);
216216

217217
fn requests_parsed(requests: &[TestRequest]) -> Vec<(String, String, String, String, bool)> {
218218
requests

0 commit comments

Comments
 (0)