Skip to content

Extra copy of struct before return #38743

@iSazonov

Description

@iSazonov

Description

Looking Guid.NewGuid() implementation I prepared a simple test on CSharpLab site
It seems the method does extra struct copy before return (g variable is defined on stack and could be returned as is).

I do not know whether this is an omission in the existing optimization, or a new optimization сould be added.

category:cq
theme:structs
skill-level:intermediate
cost:medium
impact:small

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMItenet-performancePerformance related issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions