Skip to content

AsRef/AsMut implementations aren't inlined #58867

Description

@WildCryptoFox

Many AsRef and AsMut implementations in core do not have #[inline] and yet these tiny no-op functions are called from the assembly.

The following assembly maps to AsMut<[T]> for [T]

Any quick search for as_ref or as_mut in convert.rs shows many instances, some with but many without #[inline].

_ZN63_$LT$$RF$mut$u20$T$u20$as$u20$core..convert..AsMut$LT$U$GT$$GT$6as_mut17h47b72d0f8c3b94ffE:
     .cfi_startproc
     movq    (%rdi), %rax
     movq    8(%rdi), %rdx
     retq

Edit: Default::default is another example where more aggressive inlining should be used

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

    I-slowIssue: Problems and improvements with respect to performance of generated code.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions