Skip to content

[Feature]: (Optimizations) Move Checks to Compile Time (Analyzers) #924

Description

Feature Description

Currently, we have to do a bunch of bookkeeping and machinery for our disposal leases to ensure that they are not double-disposed (ie, make them copy-safe). This is currently implemented in runtime code.

I believe for this, we could achieve the same effect (make things copy-safe) by moving the checks into an extremely robust analyzer, to prevent copies from even happening in the source. This way, we have the same result (zero-cost disposals), HOWEVER, they are even faster, since they don't need the runtime machinery.

We should investigate/research this approach, and, if it has merit, do a sweep of the code base for where we have similar patterns - runtime machinery/bookkeeping that can be moved to compile time analyzers.

Use Case / Motivation

Faster hot paths, more safety, simpler code.

Proposed Solution

No response

Alternatives Considered

No response

Unity Version

None

Package Version

None

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

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions