chore: extend path performance baselines#48
Conversation
Merging this PR will not alter performance
Performance Changes
Comparing Footnotes
|
c76bdbb to
d2ed128
Compare
d2ed128 to
500497a
Compare
There was a problem hiding this comment.
Pull request overview
This PR extends SugarPath’s performance baseline suite by introducing new, stable Criterion/CodSpeed benchmark identities (notably for non-UTF-8/native-encoding and “dirty marker position” cases) and by documenting a baseline-first protocol so future optimization PRs (e.g., #47) can get BASE vs HEAD deltas instead of “new benchmark” rows.
Changes:
- Add a dedicated
hot_path_baselinesbenchmark binary to isolate new baseline families under fat LTO. - Rename/reshape existing non-UTF-8 benchmark groups/leaf names to keep
non_utf8visible at the leaf level. - Update benchmarking and project performance-strategy documentation to codify baseline protocol and non-UTF-8 performance scope.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| Cargo.toml | Registers the new hot_path_baselines Criterion benchmark binary. |
| benchmarks/README.md | Documents non-UTF-8 naming visibility and the “baseline PR before implementation PR” workflow. |
| benches/to_slash.rs | Renames the non-UTF-8 to-slash benchmark group/IDs to be more explicit. |
| benches/normalize.rs | Renames the non-UTF-8 normalize benchmark group/ID to a non_utf8-explicit identity. |
| benches/hot_path_baselines.rs | Adds new benchmark rows for classifier-position, non-UTF-8 normalization variants, and additional relative baselines. |
| .agents/docs/README.md | Updates the PCR map to point optimization/non-UTF-8 tradeoff discussions to performance-strategy guidance. |
| .agents/docs/performance-strategy.md | Adds/expands the documented performance strategy and baseline protocol rationale. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| let base = Path::new(ROLLDOWN_ROOT); | ||
| let mut group = criterion.benchmark_group("relative/slow_path"); | ||
| group | ||
| .throughput(Throughput::Bytes((non_utf8.as_os_str().len() + base.as_os_str().len()) as u64)); | ||
| group.bench_function("non_utf8_absolute_target", |bencher| { | ||
| bencher.iter(|| black_box(non_utf8.as_path()).relative(black_box(base))); | ||
| }); |
| group.throughput(Throughput::Bytes((case.target.len() + case.base.len()) as u64)); | ||
| group.bench_function(case.name, |bencher| { | ||
| bencher.iter(|| black_box(black_box(case.target).relative(black_box(case.base)))); | ||
| }); |
| group.throughput(Throughput::Bytes(non_utf8.as_os_str().len() as u64)); | ||
| group.bench_function("borrowed_receiver/non_utf8_strict", |bencher| { | ||
| bencher.iter(|| black_box(black_box(non_utf8.as_path()).try_to_slash())); | ||
| }); | ||
| group.bench_function("borrowed_receiver/lossy_result", |bencher| { | ||
| bencher.iter(|| black_box(black_box(invalid.as_path()).to_slash_lossy())); | ||
| group.bench_function("borrowed_native/non_utf8_lossy", |bencher| { | ||
| bencher.iter(|| black_box(black_box(non_utf8.as_path()).to_slash_lossy())); | ||
| }); |
Summary
Why
This PR establishes stable CodSpeed benchmark identities before any implementation change. Draft #47 will use this branch as its base so each new case has both BASE and HEAD data instead of appearing only as new.
Validation
cargo fmt --all --checkcargo bench --locked --no-run