Performance: Layout::align()
can assume, that the alignment is a power of two
#75264
Labels
A-allocators
Area: Custom and system allocators
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
I-slow
Issue: Problems and improvements with respect to performance of generated code.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
An alignment is guaranteed to be a power of two. However without intrinsics it's not possible to use this guarantee when constructing a new
Layout
from an old one only changing the size. For testing I used the following code:dynamic_fast
assumes, that the alignment returned fromLayout
is a power of two. This results in this assembly:While in the static case, this does not matter, the dynamic case don't have to check
align.is_power_of_two()
.Normally, I would create a pull request, which adds the intrinsic to
Layout::align()
, butcore::intrinsics::assume
is not available inconst fn
s.The text was updated successfully, but these errors were encountered: