Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions benches/hot_path_baselines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@ fn bench_hot_path_baselines(criterion: &mut Criterion) {
{
let non_utf8 = invalid_unicode_path();
let non_utf8_name = non_utf8.file_name().expect("non-UTF-8 fixture has a file name").to_owned();
let mut dirty_before_non_utf8 = non_utf8.clone();
dirty_before_non_utf8.pop();
dirty_before_non_utf8.push(".");
dirty_before_non_utf8.push(&non_utf8_name);
let mut non_utf8_dirty_before = non_utf8.clone();
non_utf8_dirty_before.pop();
non_utf8_dirty_before.push(".");
non_utf8_dirty_before.push(&non_utf8_name);
let mut non_utf8_before_dirty_late = non_utf8.clone();
non_utf8_before_dirty_late.push("late");
non_utf8_before_dirty_late.push(".");
non_utf8_before_dirty_late.push("file.js");
let mut group = criterion.benchmark_group("normalize/non_utf8");
group.throughput(Throughput::Bytes(dirty_before_non_utf8.as_os_str().len() as u64));
group.bench_function("dirty_before_non_utf8", |bencher| {
bencher.iter(|| black_box(black_box(dirty_before_non_utf8.as_path()).normalize()));
group.throughput(Throughput::Bytes(non_utf8_dirty_before.as_os_str().len() as u64));
group.bench_function("non_utf8_dirty_before", |bencher| {
bencher.iter(|| black_box(black_box(non_utf8_dirty_before.as_path()).normalize()));
});
group.throughput(Throughput::Bytes(non_utf8_before_dirty_late.as_os_str().len() as u64));
group.bench_function("non_utf8_before_dirty_late", |bencher| {
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Every timed benchmark black-boxes both input and output. Setup that is not part

Benchmark and allocation scenario names describe inputs and requested output shapes. Keep accepted identities unchanged when an implementation starts borrowing, consumes an owned buffer, or removes an intermediate value. Implementation-specific alternatives may use separate control names only when they measure additional work; do not duplicate an existing timed operation under a mechanism-specific name. Stable public-operation rows let CodSpeed and saved Criterion baselines compare the accepted baseline with later implementations.

If a timed path input cannot be represented losslessly as UTF-8, include `non_utf8` in the leaf benchmark name rather than only in a parent group. GitHub and CodSpeed summaries may show only the leaf name, so each such row must remain recognizable without its full benchmark path.
If a timed path input cannot be represented losslessly as UTF-8, start the leaf benchmark name with `non_utf8` rather than identifying it only in a parent group or later in the name. GitHub and CodSpeed summaries may show only the leaf name, so each such row must remain recognizable without its full benchmark path and sort consistently with the other non-UTF-8 rows.

Never add a timed benchmark case in the same PR as the implementation it is intended to measure. First open a behavior-neutral baseline PR containing only the benchmark definition and make sure it produces a valid baseline result. Because the bench profile uses fat LTO, add a new baseline family in a dedicated benchmark binary so its code cannot perturb the layout of existing benchmark binaries. Then open the implementation PR with its base branch set to the baseline PR's branch, so CodSpeed executes the case on both sides and reports the implementation delta instead of labeling the case as new. After the baseline PR merges, rebase or retarget the implementation PR onto the merged commit without combining the two review steps.

Expand Down
Loading