Skip to content

Consider combining SystemParam::validate_params and get_params #23179

@alice-i-cecile

Description

@alice-i-cecile

@cart says:

The redundant work in validate_param, which is done immediately before get_param never felt great to me. This isn't a problem exclusive to Res/ResMut, but it is certainly present.

I think doing validation as part of get_param is more defensible from a performance perspective.

I think it is worth doing some benchmarks where we skip validation (as-in, across all SystemParams), just to see what price we're paying here.

IMO the best way to restructure this would be to have get_param return a Result<Self::Item, SystemParamValidationError>, effectively combining the signature with validate_param.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-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-UncontroversialThis work is generally agreed upon

    Type

    No type

    Projects

    Status

    Needs SME Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions