Compile-time Schedule
creation
#138
Labels
A - Scheduling
Area: Parallel scheduling of systems.
C - Enhancement
Category: New feature or request.
F - rayon
Feature: Parallel processing through the rayon library.
P - Low
Priority: Not particularly urgent.
S - Needs Investigation
Status: Further investigation is needed.
This definitely needs investigation, but I think it might be possible.
Currently,
Schedule
s are created at runtime using aschedule::Builder
. This is how every other ECS that I've seen in Rust does it. It isn't really that much of an issue in practice, since the common practice is to build aSchedule
once at the start of the program and then use it over and over again on every frame, but it does leave room for some inefficiency if, say, a user accidentally dropped and rebuilt theSchedule
on every single frame.The creation of a
Schedule
is deterministic. TheBuilder
will always create stage breaks at the same places, and those stage breaks are easily seen by examining theViews
of eachSystem
andParSystem
task.With that in mind, it should be doable to generate the
Schedule
at compile time. The idea goes something like this:enum
containing either aSystem
orParSystem
, along with other commands likeEndStage
(equivalent to theFlush
command currently in existence). The heterogeneous list could be constructed directly by a macro (see below).Stages
.EndStage
tasks are encountered, the stage will need to be cut off automatically.The ugly heterogeneous list and associated type calls can be hidden behind a nice pretty
schedule!
macro, which looks externally the same as the other heterogeneous list macros in the public API. It will basically desugar to(Task, (Task, (..., Null)))::Stages
.More investigation needs to be done to determine whether this is actually even possible.
The text was updated successfully, but these errors were encountered: