chore: remove unnecessary black_box in criterion#98
Merged
art049 merged 2 commits intoCodSpeedHQ:mainfrom Jun 27, 2025
Merged
Conversation
CodSpeed Instrumentation Performance ReportMerging #98 will degrade performances by 24.19%Comparing Summary
Benchmarks breakdown
|
CodSpeed WallTime Performance ReportMerging #98 will degrade performances by 3.01%Comparing Summary
Benchmarks breakdown
|
af3989f to
fc76872
Compare
not-matthias
approved these changes
Jun 27, 2025
Member
not-matthias
left a comment
There was a problem hiding this comment.
Good catch! We definitely should follow what criterion is doing (see their code). Since we're already wrapping it with black_box in the drop we don't have to do it before as well!
LGTM!
The original code only uses black_box when dropping, not inside of the measurement.
Apply the same optimization from PR 98 to both divan and bencher compat layers: - Remove black_box around routine calls during measurement - Only apply black_box to outputs after measurement ends - Reduces stack usage and eliminates unnecessary memory operations - Improves benchmark performance by avoiding artificial overhead 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
a7c4bcd to
b71c93b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The original code only uses black_box when dropping, not inside of the measurement.
This actually matters as black_box usually spills the value to the stack, so if the benchmark routine returns a large value, the benchmark will record also an unnecessary memcpy.