Skip to content

fix(criterion-compat): fix URI formatting when criterion_group!/criterion_main! are bypassed#169

Open
not-matthias wants to merge 1 commit intomainfrom
cod-2324-investigate-issues-with-uri-formatting-in-codspeed-criterion
Open

fix(criterion-compat): fix URI formatting when criterion_group!/criterion_main! are bypassed#169
not-matthias wants to merge 1 commit intomainfrom
cod-2324-investigate-issues-with-uri-formatting-in-codspeed-criterion

Conversation

@not-matthias
Copy link
Member

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes CodSpeed Criterion-compat benchmark URI construction when users bypass criterion_group! / criterion_main! (e.g., custom main), ensuring URIs don’t include empty segments and that current_file is derived from the callsite when missing.

Changes:

  • Build benchmark URIs from non-empty components (file / macro group / group name / function) to avoid malformed :: sequences.
  • Derive current_file from #[track_caller] callsite when criterion_group! didn’t set it.
  • Add a new bench reproducer for the “custom main” scenario and register it in Cargo.toml.

Reviewed changes

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

File Description
crates/criterion_compat/src/compat/group.rs Makes URI formatting robust to missing file and/or macro group components.
crates/criterion_compat/src/compat/criterion.rs Adds callsite-based fallback to populate current_file when macros aren’t used.
crates/criterion_compat/benches/repro_custom_main.rs Adds a reproducer bench for bypassing criterion_group!/criterion_main!.
crates/criterion_compat/Cargo.toml Registers the new repro_custom_main bench target.

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

You can also share your feedback on Copilot code review. Take the survey.

@codspeed-hq
Copy link

codspeed-hq bot commented Mar 13, 2026

Merging this PR will degrade performance by 23.81%

⚡ 6 improved benchmarks
❌ 6 regressed benchmarks
✅ 563 untouched benchmarks
🆕 10 new benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
WallTime slice_into_vec_with_bytes 94 ns 57 ns +64.91%
WallTime string_copy_with_bytes_counter 56 ns 58 ns -3.45%
WallTime knight_tour[7] 250.8 ms 267.7 ms -6.3%
WallTime iterative[10] 16 ns 21 ns -23.81%
WallTime iter_batched_ref_large_input 44 ns 48 ns -8.33%
🆕 WallTime my_bench N/A < 1 ns N/A
WallTime iter_batched_per_iteration 44 ns 48 ns -8.33%
🆕 WallTime parameterized[42] N/A < 1 ns N/A
WallTime bench_array2[10] 29 ns 9 ns ×3.2
WallTime bench_array2[42] 51 ns 66 ns -22.73%
WallTime fib_10 413 ns 375 ns +10.13%
🆕 Memory my_bench N/A 0 B N/A
🆕 Memory parameterized[42] N/A 0 B N/A
🆕 Memory my_bench N/A 0 B N/A
🆕 Memory parameterized[42] N/A 0 B N/A
🆕 Simulation my_bench N/A < 1 ns N/A
🆕 Simulation parameterized[42] N/A < 1 ns N/A
🆕 Simulation my_bench N/A < 1 ns N/A
Simulation Iterative 161.9 ns 132.8 ns +21.97%
Simulation Iterative[20] 161.9 ns 132.8 ns +21.97%
... ... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.


Comparing cod-2324-investigate-issues-with-uri-formatting-in-codspeed-criterion (3fddbb2) with main (dccf5f4)

Open in CodSpeed

@not-matthias not-matthias force-pushed the cod-2324-investigate-issues-with-uri-formatting-in-codspeed-criterion branch from 74da3b2 to 3fddbb2 Compare March 16, 2026 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants