-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-layoutArea: Memory layout of typesArea: Memory layout of typesC-optimizationCategory: An issue highlighting optimization opportunities or PRs implementing suchCategory: An issue highlighting optimization opportunities or PRs implementing suchE-needs-designThis issue needs exploration and design to see how and if we can fix/implement itThis issue needs exploration and design to see how and if we can fix/implement itT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
From reddit thread: why can't rust optimize the size of Option<Option<&str>>
?
Indeed, in spite of the fact that &str
doesn't all use more than half of possible bit sequences (top bit of 2nd word is always zero, plus first word can not be zero) only Option<&str>
is optimized
Would it make sense to teach compiler about that niche or is it prevented by some deeper issue?
Metadata
Metadata
Assignees
Labels
A-layoutArea: Memory layout of typesArea: Memory layout of typesC-optimizationCategory: An issue highlighting optimization opportunities or PRs implementing suchCategory: An issue highlighting optimization opportunities or PRs implementing suchE-needs-designThis issue needs exploration and design to see how and if we can fix/implement itThis issue needs exploration and design to see how and if we can fix/implement itT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.