Skip to content

Conversation

@stepancheg
Copy link
Contributor

All #[cold] to all error constructors.

As discussed in the issue #165,
marking functions cold helps LLVM optimize code paths not leading to error.

Although in our case marking only from was enough, I took the
liberty of marking all error constructors #[cold].

Note, I marked cold both inner function and public functions, because
LLVM does not always takes into account #[cold] attribute of inlined functions,
see an example in compiled explorer.

All `#[cold]` to all error constructors.

As discussed in the [issue dtolnay#165](dtolnay#165),
marking functions cold helps LLVM optimize code paths not leading to error.

Although in our case marking only `from` was enough, I took the
liberty of marking all error constructors `#[cold]`.

Note, I marked cold both inner function and public functions, because
LLVM does not always takes into account `#[cold]` attribute of inlined functions,
see [an example in compiled explorer](https://rust.godbolt.org/z/vzxazMMnb).
Copy link
Owner

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

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

Thanks!

@dtolnay dtolnay merged commit 447eff8 into dtolnay:master Sep 12, 2021
@stepancheg stepancheg deleted the cold branch September 12, 2021 19:24
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.

2 participants