Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline "small" systems into the multithreaded executor #7693

Closed
wants to merge 1 commit into from

Conversation

james7132
Copy link
Member

Objective

Minimize overhead from scheduling large numbers of systems with very little work to do. Partially address #7208.

Solution

Keep a exponential moving average for how long it takes to run each system. If a system has historically run in under 2 microseconds, run it inside the multithreaded executor.

The threshold is currently hard-coded and is rather conservative to avoid potentially inlining too many systems and forcing it large sections to run single threaded.

TODO:

  • Defer inline execution until all non-inlinable system tasks are spawned to avoid blocking
  • Add an escape hatch for cases where systems have highly kurtotic behavior.

Performance

TODO

@james7132 james7132 added A-ECS Entities, components, systems, and events C-Performance A change motivated by improving speed, memory usage or compile times labels Feb 16, 2023
@alice-i-cecile alice-i-cecile added the X-Controversial There is active debate or serious implications around merging this PR label Feb 16, 2023
@james7132
Copy link
Member Author

With #11906 now running the multithreaded executor immediately after every system, we can achieve similar results without needing to inline the systems. I've also come to realize that running systems inline is likely an all around bad practice given that it potentially blocks starting new systems even without a strict before/after relationship, and that's a huge risk in any cooperative task scheduler. Closing this out.

@james7132 james7132 closed this Mar 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Performance A change motivated by improving speed, memory usage or compile times X-Controversial There is active debate or serious implications around merging this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants