Skip to content

Play with core::hint::cold_path() #153

Description

@ounsworth

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomershelp wantedCould be picked up by anyone in the communityresearchThis involves some open-ended research

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions