Skip to content

Overhaul schedule module.#142

Merged
Anders429 merged 18 commits into
devfrom
schedule
Nov 17, 2022
Merged

Overhaul schedule module.#142
Anders429 merged 18 commits into
devfrom
schedule

Conversation

@Anders429

Copy link
Copy Markdown
Owner

Completely removes the run-time builder system for schedules. Instead, type-level recursion is used for defining stages. Stages are defined respective of a registry (this was the only way I could get around the need for negative trait bounds, since creating an inverse set of a set of views using a registry can simulate negative trait bounds), which means that stages are actually assembled from the list of tasks when World::run_schedule() is called. This should, however, be really cheap, since the type system has already defined the stages. The only work needed to be done at runtime is to reference the tasks into their stages.

Therefore, schedules are now defined as heterogeneous lists of tasks. This eliminates the need for the complicated stages! macro, allowing us to define a simple heterogeneous list like is done elsewhere.

Future work may involve a Schedule! macro for generating the type of a schedule. This can make it easier for users to store schedules.

Honestly, I'm pretty proud of the type-level recursion stuff going on here. It came out super clean. It basically does the same thing that was being done at run-time previously, but all using the trait system.

Fixes #138.

@Anders429 Anders429 added C - Enhancement Category: New feature or request. C - Code Quality Category: Addressing quality and cleanup of existing code. P - Low Priority: Not particularly urgent. F - rayon Feature: Parallel processing through the rayon library. A - Scheduling Area: Parallel scheduling of systems. V - Major Breaking Change Versioning: Requires a major bump according to semver. labels Nov 17, 2022
@Anders429

Anders429 commented Nov 17, 2022

Copy link
Copy Markdown
Owner Author

It appears a change in the latest Rust nightly has caused the trybuild tests to fail. I will add a fix for those to this PR.

Edit: Yep, the culprit is this PR.

@Anders429

Copy link
Copy Markdown
Owner Author

Fixed the test output. Not sure why result/comma_alone.stderr seems to produce a different error than the others, but I think it's acceptable.

@codecov-commenter

codecov-commenter commented Nov 17, 2022

Copy link
Copy Markdown

Codecov Report

Merging #142 (5e79390) into dev (1396d59) will decrease coverage by 0.26%.
The diff coverage is 74.10%.

@@            Coverage Diff             @@
##              dev     #142      +/-   ##
==========================================
- Coverage   95.08%   94.81%   -0.27%     
==========================================
  Files          73       73              
  Lines        9991    10223     +232     
==========================================
+ Hits         9500     9693     +193     
- Misses        491      530      +39     
Impacted Files Coverage Δ
src/system/mod.rs 0.00% <ø> (ø)
src/system/schedule/mod.rs 71.34% <71.22%> (-28.66%) ⬇️
src/system/schedule/stager.rs 81.25% <81.25%> (ø)
src/system/schedule/scheduler.rs 100.00% <100.00%> (ø)
src/system/schedule/sealed.rs 100.00% <100.00%> (ø)
src/system/schedule/stage.rs 100.00% <100.00%> (ø)
src/system/schedule/stages.rs 100.00% <100.00%> (ø)
src/system/schedule/task/sealed.rs 100.00% <100.00%> (ø)
src/world/mod.rs 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@Anders429
Anders429 merged commit 887cf9d into dev Nov 17, 2022
@Anders429
Anders429 deleted the schedule branch November 17, 2022 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A - Scheduling Area: Parallel scheduling of systems. C - Code Quality Category: Addressing quality and cleanup of existing code. C - Enhancement Category: New feature or request. F - rayon Feature: Parallel processing through the rayon library. P - Low Priority: Not particularly urgent. V - Major Breaking Change Versioning: Requires a major bump according to semver.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants