Skip to content

Introduce perf-report.yml - #712

Open
atuchin-m wants to merge 15 commits into
masterfrom
introduce-perf-report
Open

Introduce perf-report.yml#712
atuchin-m wants to merge 15 commits into
masterfrom
introduce-perf-report

Conversation

@atuchin-m

@atuchin-m atuchin-m commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

The PR introduces a new optional CI build to generate a detailed perf report.

  • It runs tests before/after and output the results;
  • uses linux perf + inferno to produce a flamegraph;
  • also provides differential flamegraphs;
  • uses rustfilt to propery demangle flamegraphs;
  • activates once you added perf-report label and removes it after the run.

An example report on a test pr with a worse tokenization strategy:
https://github.com/brave/adblock-rust/actions/runs/30578642537/artifacts/8773964960

the flamegraph diff:
image

@atuchin-m atuchin-m self-assigned this Jul 30, 2026
@atuchin-m atuchin-m added the perf-report Generate a detail performance report for the PR label Jul 30, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Rust Benchmark

Details
Benchmark suite Current: 2fcf380 Previous: dc4d694 Ratio
rule-match-browserlike/brave-list 1389497420 ns/iter (± 22782504) 2099334199 ns/iter (± 17991214) 0.66
rule-match-first-request/brave-list 1120369 ns/iter (± 25473) 1421104 ns/iter (± 10951) 0.79
blocker_new/brave-list 78686703 ns/iter (± 2306165) 112417642 ns/iter (± 561176) 0.70
blocker_new/brave-list-deserialize 21810222 ns/iter (± 553436) 32505677 ns/iter (± 1294449) 0.67
memory-usage-final/brave-list-initial 9561338 B/iter (± 0) 9561338 B/iter (± 0) 1
memory-usage-final/brave-list-1000-requests 3183886 B/iter (± 0) 3183886 B/iter (± 0) 1
memory-usage-max/brave-list-initial/max 32070026 B/iter (± 0) 32070026 B/iter (± 0) 1
memory-usage-alloc-count/brave-list-initial/alloc-count 284089 allocs/iter (± 0) 284089 allocs/iter (± 0) 1
memory-usage-alloc-count/brave-list-1000-requests/alloc-count 80628 allocs/iter (± 0) 80628 allocs/iter (± 0) 1
url_cosmetic_resources/brave-list 131354 ns/iter (± 2653) 184145 ns/iter (± 1771) 0.71
cosmetic-class-id-match/brave-list 2134858 ns/iter (± 557919) 3240078 ns/iter (± 845876) 0.66

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Rust Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.10.

Benchmark suite Current: 1a4845c Previous: dc4d694 Ratio
rule-match-first-request/brave-list 1589064 ns/iter (± 11987) 1421104 ns/iter (± 10951) 1.12

This comment was automatically generated by workflow using github-action-benchmark.

@atuchin-m atuchin-m added perf-report Generate a detail performance report for the PR and removed perf-report Generate a detail performance report for the PR labels Jul 30, 2026
@atuchin-m atuchin-m added perf-report Generate a detail performance report for the PR and removed perf-report Generate a detail performance report for the PR labels Jul 30, 2026
@github-actions

Copy link
Copy Markdown

Performance report

dc4d69429fa72f3f8ac6a5700d0989172138e30f (base) → bd2f57a3f07b8259d789a06a8239faa50cf2e9d6 (head)

group                                  base                                    head
-----                                  ----                                    ----
blocker_new/brave-list                 1.00    115.2±0.51ms     8 Elem/sec     1.02    117.5±0.65ms     8 Elem/sec
blocker_new/brave-list-deserialize     1.00     30.5±0.62ms    32 Elem/sec     1.06     32.4±0.21ms    30 Elem/sec
cosmetic-class-id-match/brave-list     1.04      3.8±0.98ms   263 Elem/sec     1.00      3.7±0.96ms   272 Elem/sec
rule-match-browserlike/brave-list      1.00  1903.3±13.96ms 124.6 KElem/sec    1.00   1905.1±8.68ms 124.5 KElem/sec
rule-match-first-request/brave-list    1.00   1408.0±5.89µs        ? ?/sec     1.00  1406.4±13.25µs        ? ?/sec
url_cosmetic_resources/brave-list      1.00    182.0±0.88µs  5.4 KElem/sec     1.00    182.0±0.71µs  5.4 KElem/sec

Flamegraphs are attached as the perf-report artifact of this run:
matching / startup, each with a base, a head and a differential SVG.
Download and open them in a browser to zoom and search.

@github-actions github-actions Bot removed the perf-report Generate a detail performance report for the PR label Jul 30, 2026
@atuchin-m atuchin-m added the perf-report Generate a detail performance report for the PR label Jul 30, 2026
import html
import pathlib
import re
import subprocess

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

reported by reviewdog 🐶
[opengrep] Consider possible security implications associated with subprocess module.


Source: https://semgrep.dev/r/gitlab.bandit.B404


Cc @thypon

Please consider an alternative approach that avoids this security concern, or request a review from the sec-team on slack.

@github-actions

Copy link
Copy Markdown

Performance report

dc4d69429fa72f3f8ac6a5700d0989172138e30f (base) → f25070d9e7a8901b572f35fab392959fc079c11a (head)

group                                  base                                    head
-----                                  ----                                    ----
blocker_new/brave-list                 1.00    115.4±0.25ms     8 Elem/sec     1.00    115.6±0.30ms     8 Elem/sec
cosmetic-class-id-match/brave-list     1.00      3.6±0.97ms   280 Elem/sec     1.00      3.6±0.94ms   279 Elem/sec
rule-match-browserlike/brave-list      1.00       2.1±0.01s 113.2 KElem/sec    1.00       2.1±0.01s 113.5 KElem/sec
rule-match-first-request/brave-list    1.00  1377.1±10.17µs        ? ?/sec     1.01  1392.9±52.27µs        ? ?/sec
url_cosmetic_resources/brave-list      1.00    190.0±0.88µs  5.1 KElem/sec     1.00    190.7±1.02µs  5.1 KElem/sec

Flamegraphs: download perf-report.html artifact from this run and open it in a browser.

@github-actions github-actions Bot removed the perf-report Generate a detail performance report for the PR label Jul 30, 2026
@atuchin-m atuchin-m added the perf-report Generate a detail performance report for the PR label Jul 30, 2026
@github-actions

Copy link
Copy Markdown

Performance report

dc4d69429fa72f3f8ac6a5700d0989172138e30f (base) → 9637ec8cbfdde255607448585e93ead1698a0d94 (head)

group                                  base                                    head
-----                                  ----                                    ----
blocker_new/brave-list                 1.00    114.0±0.67ms     8 Elem/sec     1.02    116.2±0.67ms     8 Elem/sec
cosmetic-class-id-match/brave-list     1.00      3.6±0.95ms   280 Elem/sec     1.00      3.5±0.92ms   281 Elem/sec
rule-match-browserlike/brave-list      1.02       2.1±0.04s 111.8 KElem/sec    1.00       2.1±0.01s 113.7 KElem/sec
rule-match-first-request/brave-list    1.00  1383.0±13.05µs        ? ?/sec     1.00  1389.9±11.45µs        ? ?/sec
url_cosmetic_resources/brave-list      1.01    190.9±1.54µs  5.1 KElem/sec     1.00    189.9±1.03µs  5.1 KElem/sec

Flamegraphs: https://github.com/brave/adblock-rust/actions/runs/30549895108/artifacts/8762588382 (open while logged into GitHub).

@github-actions github-actions Bot removed the perf-report Generate a detail performance report for the PR label Jul 30, 2026
@atuchin-m atuchin-m added the perf-report Generate a detail performance report for the PR label Jul 30, 2026
@github-actions

Copy link
Copy Markdown

Performance report

dc4d69429fa72f3f8ac6a5700d0989172138e30f (base) → cabd395039a423591a451926ee2e903b30a283ca (head)

group                                  base                                    head
-----                                  ----                                    ----
blocker_new/brave-list                 1.00    113.6±1.50ms     8 Elem/sec     1.01    115.1±0.40ms     8 Elem/sec
cosmetic-class-id-match/brave-list     1.03      3.4±0.92ms   295 Elem/sec     1.00      3.3±0.85ms   304 Elem/sec
rule-match-browserlike/brave-list      1.00       2.2±0.01s 109.9 KElem/sec    1.00       2.2±0.01s 109.8 KElem/sec
rule-match-first-request/brave-list    1.00   1407.3±9.82µs        ? ?/sec     1.00  1412.9±10.18µs        ? ?/sec
url_cosmetic_resources/brave-list      1.01    199.2±2.58µs  4.9 KElem/sec     1.00    197.4±0.87µs  4.9 KElem/sec

Flamegraphs: https://github.com/brave/adblock-rust/actions/runs/30575395224/artifacts/8772699195 (open while logged into GitHub).

@github-actions github-actions Bot removed the perf-report Generate a detail performance report for the PR label Jul 30, 2026
@atuchin-m atuchin-m added the perf-report Generate a detail performance report for the PR label Jul 30, 2026
@github-actions

Copy link
Copy Markdown

Performance report

dc4d69429fa72f3f8ac6a5700d0989172138e30f (base) → 1a4845c4c1149138e7675b92fa5db5e10524df99 (head)

group                                  base                                    head
-----                                  ----                                    ----
blocker_new/brave-list                 1.02    115.4±0.46ms     8 Elem/sec     1.00    113.0±0.30ms     8 Elem/sec
blocker_new/brave-list-deserialize     1.06     37.4±0.45ms    26 Elem/sec     1.00     35.2±0.20ms    28 Elem/sec
cosmetic-class-id-match/brave-list     1.00      3.3±0.87ms   307 Elem/sec     1.03      3.3±0.96ms   299 Elem/sec
rule-match-browserlike/brave-list      1.01       2.1±0.02s 110.6 KElem/sec    1.00       2.1±0.00s 111.3 KElem/sec
rule-match-first-request/brave-list    1.01   1410.2±8.15µs        ? ?/sec     1.00   1394.8±5.53µs        ? ?/sec
url_cosmetic_resources/brave-list      1.01    198.5±1.44µs  4.9 KElem/sec     1.00    197.2±0.80µs  5.0 KElem/sec

Flamegraphs: https://github.com/brave/adblock-rust/actions/runs/30576952169/artifacts/8773326424.

@github-actions github-actions Bot removed the perf-report Generate a detail performance report for the PR label Jul 30, 2026
@atuchin-m
atuchin-m marked this pull request as ready for review July 30, 2026 20:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds an on-demand GitHub Actions workflow to generate a detailed, artifact-backed performance report for pull requests by benchmarking and profiling both the PR head and its merge base.

Changes:

  • Introduces a new optional perf-report workflow that benchmarks + profiles base vs head and posts a PR comment linking to the generated report artifact.
  • Adds scripts to run Criterion baselines, capture perf profiles, and build a self-contained HTML report embedding flamegraphs and critcmp output.
  • Normalizes quoting in the existing benchmark runner script for consistency with the new tooling.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
.github/workflows/perf-report.yml New labeled/manual workflow that installs perf tooling, runs base/head benchmarks + profiles, builds and uploads the HTML report, comments on the PR, and removes the label.
.github/scripts/run-perf-profile.sh New script to perf record selected benchmarks and render (diff) flamegraphs via inferno + rustfilt.
.github/scripts/run-perf-benchmarks.sh New script to save Criterion baselines for base/head so critcmp can diff them.
.github/scripts/run-benchmarks.sh Small update to quote benchmark filters consistently.
.github/scripts/build-perf-report.py New report builder that embeds SVG flamegraphs and a critcmp table into a single HTML artifact and emits PR-comment markdown.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/perf-report.yml Outdated
Comment thread .github/scripts/run-perf-profile.sh Outdated
Comment thread .github/scripts/build-perf-report.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants