Skip to content

NativeAOT type instantiation sharing #83318

Description

@NinoFloris

In similar vein of #82591, would it be possible to reduce duplication when all type parameters on a type are not relevant for type layout/size?

As an example

// or struct
class Wrapper<T>
{
    public List<T> Value { get; }
}

As I understand it today this produces a new instantiation per value type for T.
I understand .NET isn't (immediately) going to support gc shapes (in the golang generics sense) as a size optimization. However this particular case seems like an analysis that can be done at the template level which can 'significantly' reduce bloat.

Is there any appetite for optimizations like these?

@MichalStrehovsky

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-NativeAOT-coreclrquestionAnswer questions and provide assistance, not an issue with source code or documentation.

    Type

    No type

    Projects

    Status
    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions