Skip to content

Conversation

@febo
Copy link
Collaborator

@febo febo commented Aug 28, 2025

Problem

It is possible to add hints to the compiler to help it optimize the code and save CUs – e.g., as it is used in p-token.

Solution

Add a new module hint with heper functions. This is similar to the experimental API from core::hint.

Credits to @cavemanloverboy for this suggestion.

@febo febo requested review from joncinque and rustopian August 28, 2025 13:34
rustopian

This comment was marked as duplicate.

Copy link
Contributor

@rustopian rustopian left a comment

Choose a reason for hiding this comment

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

Clearing my earlier suggestion for #[inline(never)], seems not to matter. Approved as is.

Comment on lines +276 to +277
#[cold]
pub const fn cold_path() {}
Copy link
Contributor

@rustopian rustopian Aug 28, 2025

Choose a reason for hiding this comment

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

#[inline(never)] on cold_path doesn't seem to make a difference - perhaps there are some cases where it would - I'll try a bit more and if so will propose separately.

@febo febo merged commit dd52b4a into main Aug 29, 2025
11 checks passed
@febo febo deleted the febo/mod-hint branch August 29, 2025 09:18
@febo febo restored the febo/mod-hint branch August 29, 2025 10:50
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.

4 participants