-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Tracking issue for std::hint::black_box #64102
Copy link
Copy link
Closed
Labels
B-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.Blocker: Approved by a merged RFC but not yet implemented.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCLibs-TrackedLibs issues that are tracked on the team's project board.Libs issues that are tracked on the team's project board.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.This issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.The final comment period is finished for this PR / Issue.
Metadata
Metadata
Assignees
Labels
B-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.Blocker: Approved by a merged RFC but not yet implemented.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCLibs-TrackedLibs issues that are tracked on the team's project board.Libs issues that are tracked on the team's project board.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.This issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.The final comment period is finished for this PR / Issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
This is a tracking issue for the RFC
std::hint:_black_box.Original RFC: RFC 2360
Public API:
Steps:
Unresolved questions:
const fn: it is unclear whetherbench_black_boxshould be aconst fn. If itwere, that would hint that it cannot have any side-effects, or that it cannot
do anything that
const fns cannot do.Naming: during the RFC discussion it was unclear whether
black_boxis theright name for this primitive but we settled on
bench_black_boxfor the timebeing. We should resolve the naming before stabilization.
Also, we might want to add other benchmarking hints in the future, like
bench_inputandbench_output, so we might want to put all of thisinto a
benchsub-module within thecore::hintmodule. That mightbe a good place to explain how the benchmarking hints should be used
holistically.
Some arguments in favor or against using "black box" are that:
that nothing can be assumed about it except for its inputs and outputs.
con: [black box] often hints that the function has no side-effects, but
this is not something that can be assumed about this API.
_boxhas nothing to do withBoxorbox-syntax, which might be confusingAlternative names suggested:
pessimize,unoptimize,unprocessed,unknown,do_not_optimize(Google Benchmark).