Skip to content

Consider combining SystemParam::validate_params and get_params #23179

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-ComplexQuite challenging from either a design or technical perspective. Ask for help!S-BlockedThis cannot move forward until something else changesX-ContentiousThere are nontrivial implications that should be thought through

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions