fix(criterion-compat): fix URI formatting when criterion_group!/criterion_main! are bypassed#169
Conversation
There was a problem hiding this comment.
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_filefrom#[track_caller]callsite whencriterion_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.
Merging this PR will degrade performance by 23.81%
Performance Changes
Comparing |
…rion_main! are bypassed
74da3b2 to
3fddbb2
Compare
No description provided.