Skip to content

Investigate an optimised form of IBindable that lazily updates with associated Drawable #3937

Open
@peppy

Description

@peppy

Proposal:

Add a new DI method which consumes a parent bindable but doesn't do a direct bind. On each Drawable.Update state would be synchronised and updated internally. Something like:

[ResolvedLazy]
protected IBindable<bool> lazyUpdateBindable;

Could be used for scenarios where many components (that may only be alive for a short period, ie gameplay objects) are binding to a hot parent (ie. a SkinSource bindable) and don't want the overhead of handling a value change event until they become updated/alive.

An example where we manually work around such performance bottlenecks using Schedule calls (which have their own smaller overhead):

https://github.com/ppy/osu/blob/583fdc3a95cad81db3819c797c3f1cbf8ae554ff/osu.Game/Skinning/SkinReloadableDrawable.cs#L45-L51

Going to milestone for a prelim. investigation of whether this can be easily implemented (in theory it should be a quick one).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions