mirrored from https://www.bouncycastle.org/repositories/bc-rust
-
Notifications
You must be signed in to change notification settings - Fork 19
Play with core::hint::cold_path() #153
Copy link
Copy link
Open
Labels
good first issueGood for newcomersGood for newcomershelp wantedCould be picked up by anyone in the communityCould be picked up by anyone in the communityresearchThis involves some open-ended researchThis involves some open-ended research
Description
Activity
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomershelp wantedCould be picked up by anyone in the communityCould be picked up by anyone in the communityresearchThis involves some open-ended researchThis involves some open-ended research
https://doc.rust-lang.org/core/hint/fn.cold_path.html
It allows you to give the compiler hints about branches that are extremely unlikely, or where you don't care about performance (like an error path).
This ticket is a research task to try using
core::hint::cold_path()on some of the performance-critical sections of algorithms and see if it gives enough of a performance boost to be worth littering the code with it. We would need solid data from our own benchmarks that this actually represents a positive change.My intuition is that it probably does not because the parts of crypto that have expensive branches tend to be done many thousands of times, and therefore the CPU built-in branch predictors probably work fairly well.