Skip to content

Commit 7da939f

Browse files
Copilotjsturtevantludfjigsyntactically
authored
Enforce release builds for benchmarks and simplify command interface (#741)
* Initial plan Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com> * Enforce release builds for benchmarks in Justfile and source code Co-authored-by: jsturtevant <648372+jsturtevant@users.noreply.github.com> Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com> * Remove compile-time error for benchmarks to allow profiling with debug symbols Co-authored-by: ludfjig <4257730+ludfjig@users.noreply.github.com> Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com> * Remove unnecessary target parameter from bench commands - Remove target parameter from bench and bench-ci commands since they only accept release builds - Update GitHub workflows to remove target parameter usage - Simplify command signatures based on @syntactically's feedback Co-authored-by: syntactically <168595099+syntactically@users.noreply.github.com> Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com> * Update documentation to reflect that debug builds are now supported for profiling Co-authored-by: ludfjig <4257730+ludfjig@users.noreply.github.com> Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com> --------- Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jsturtevant <648372+jsturtevant@users.noreply.github.com> Co-authored-by: ludfjig <4257730+ludfjig@users.noreply.github.com> Co-authored-by: syntactically <168595099+syntactically@users.noreply.github.com>
1 parent 243913b commit 7da939f

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

.github/workflows/Benchmarks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5858

5959
- name: Run Benchmarks
60-
run: just bench-ci main release ${{ matrix.hypervisor == 'mshv' && 'mshv2' || ''}}
60+
run: just bench-ci main ${{ matrix.hypervisor == 'mshv' && 'mshv2' || ''}}
6161

6262
- uses: actions/upload-artifact@v4
6363
with:

.github/workflows/dep_rust.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,5 +186,5 @@ jobs:
186186

187187
- name: Run benchmarks
188188
run: |
189-
just bench-ci main ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv' && 'mshv2' || ''}}
189+
just bench-ci main ${{ matrix.hypervisor == 'mshv' && 'mshv2' || ''}}
190190
if: ${{ matrix.config == 'release' }}

Justfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,11 +326,13 @@ bench-download os hypervisor cpu tag="":
326326
tar -zxvf target/benchmarks_{{ os }}_{{ hypervisor }}_{{ cpu }}.tar.gz -C target/criterion/ --strip-components=1
327327

328328
# Warning: compares to and then OVERWRITES the given baseline
329-
bench-ci baseline target=default-target features="":
330-
cargo bench --profile={{ if target == "debug" { "dev" } else { target } }} {{ if features =="" {''} else { "--features " + features } }} -- --verbose --save-baseline {{ baseline }}
329+
bench-ci baseline features="":
330+
@# Benchmarks are always run with release builds for meaningful results
331+
cargo bench --profile=release {{ if features =="" {''} else { "--features " + features } }} -- --verbose --save-baseline {{ baseline }}
331332

332-
bench target=default-target features="":
333-
cargo bench --profile={{ if target == "debug" { "dev" } else { target } }} {{ if features =="" {''} else { "--features " + features } }} -- --verbose
333+
bench features="":
334+
@# Benchmarks are always run with release builds for meaningful results
335+
cargo bench --profile=release {{ if features =="" {''} else { "--features " + features } }} -- --verbose
334336

335337
###############
336338
### FUZZING ###

docs/benchmarking-hyperlight.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,6 @@ Found 1 outliers among 100 measurements (1.00%)
7272
7373
## Running benchmarks locally
7474
75-
Use `just bench [debug/release]` parameter to run benchmarks. Comparing local benchmarks results to github-saved benchmarks doesn't make much sense, since you'd be using different hardware, but you can use `just bench-download os hypervisor [tag] ` to download and extract the GitHub release benchmarks to the correct place folder. You can then run `just bench-ci main` to compare to (and overwrite) the previous release benchmarks. Note that `main` is the name of the baselines stored in GitHub.
75+
Use `just bench` to run benchmarks with release builds (the only supported configuration). Comparing local benchmark results to github-saved benchmarks doesn't make much sense, since you'd be using different hardware, but you can use `just bench-download os hypervisor [tag] ` to download and extract the GitHub release benchmarks to the correct place folder. You can then run `just bench-ci main` to compare to (and overwrite) the previous release benchmarks. Note that `main` is the name of the baselines stored in GitHub.
76+
77+
**Important**: The `just bench` command uses release builds by default to ensure meaningful performance measurements. For profiling purposes, you can compile benchmarks with debug symbols by running `cargo bench` directly.

0 commit comments

Comments
 (0)