Skip to content

Reflection should be fully optional and toggleable at a bevy level #20337

@alice-i-cecile

Description

@alice-i-cecile

What problem does this solve or what need does it fill?

Reflection results in significant increases to compile times and binary size, and in many projects, is only useful as a development tool.

What solution would you like?

bevy_reflect should be an optional dependency for all Bevy crates whenever possible,
and we should have a reflect feature flag on bevy itself that controls this.

Because of our setup, this will need to be mirrored to bevy_internal.

What alternative(s) have you considered?

We could gate this behind the debug feature flag, as they serve similar roles, but not debug / dev applications of reflection exist.

Additional context

I encountered this when trying to fix #20038. Because a top-level feature flag does not exist, there's not much point in doing this now: bevy_reflect will still be drawn into your tree and other crates will still have reflection information embedded.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-Cross-CuttingImpacts the entire engineA-ReflectionRuntime information about typesC-FeatureA new feature, making something new possibleC-PerformanceA change motivated by improving speed, memory usage or compile timesD-ModestA "normal" level of difficulty; suitable for simple features or challenging fixesS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!X-ContentiousThere are nontrivial implications that should be thought through

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions