Skip to content

[Discussion] store values as union of ref type #210

@m00shm00sh

Description

@m00shm00sh

Presently, the source generator generates a member for each type.

Would it be practical to instead have a private readonly object? _theObj and instead generate private T{#} _value{#} => Unsafe.As<T{#}>(_theObj) instead so that only one object is stored instead of N?

A downside here is the boxing that using struct instead of class avoids becomes cancelled since value types will have to be boxed to be storable in an object? but the upside is for a large number of objects, less storage is wasted because only the active object is stored instead of default values for all the unused one(s).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions