Skip to content

Current state of multi-threading... #145

@nrader95

Description

@nrader95

When multi-threading with default runner, it seems there is big overhead for me. When i profiled with Unity profiler, system updates sometimes can take twice more time to execute for some reason. (and it was in middle of various methods, both mine and ecs methods(including entity.Get<>, for example)). I tried to write my own IParallelRunner based on System.Threading.Task<T> and result was the same. So if degree of paralelism is low, it can actually result in loss of performance.

Then i tried to use raw Threads from System.Threading instead of Tasks, and overhead was finally gone. So using Tasks seems to be the bad way in at least some cases.

Even if overhead i'm observing has anything to do with syncronization, current limitations on multi-threading for working with framework already prohibit changing entity composition. There is still that scenario where you write data into component after getting it from 2+ threads, but that's not always the case.

So i think you should consider changing default runner, or maybe alternative fast&unsafe one for safe-write systems.

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