-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-codegenArea: Code generationArea: Code generationI-slowIssue: Problems and improvements with respect to performance of generated code.Issue: Problems and improvements with respect to performance of generated code.
Description
I expect the following two snippets to have the same performance:
#[inline(always)]
fn decrement(val: u32) -> Option<u32> {
if val != 0 {
Some(val - 1)
} else {
None
}
}
match decrement(a) {
Some(aa) => /* do something */ {},
None => /* do something else */ {},
}
and
if a != 0 {
a - 1;
/* do something */
} else {
/* do something else */
}
The latter one has better performance in current Rust: Gist.
Metadata
Metadata
Assignees
Labels
A-codegenArea: Code generationArea: Code generationI-slowIssue: Problems and improvements with respect to performance of generated code.Issue: Problems and improvements with respect to performance of generated code.