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

Add traces to run criteria #4681

Closed
SUPERCILEX opened this issue May 6, 2022 · 2 comments
Closed

Add traces to run criteria #4681

SUPERCILEX opened this issue May 6, 2022 · 2 comments
Labels
C-Enhancement A new feature S-Needs-Triage This issue needs to be labelled

Comments

@SUPERCILEX
Copy link
Contributor

What problem does this solve or what need does it fill?

Understanding the performance of run criteria.

What solution would you like?

Set up trace spans around run criteria. Currently there are none. See bevyengine/bevy-website#265 (comment) where it would be helpful to see the overhead of run criteria.

@SUPERCILEX SUPERCILEX added C-Enhancement A new feature S-Needs-Triage This issue needs to be labelled labels May 6, 2022
@hymm
Copy link
Contributor

hymm commented May 9, 2022

If a system includes a top-level guard such as mouse_button_input.just_pressed(MouseButton::Left), is it faster to put that in run criteria so that the actual system doesn't get run? My guess based on this line would be yes, but I'm not sure how much overhead adding run criteria entails so maybe not.

I didn't want to answer this question on the other thread and add noise there. So I'm putting it here where there is likely to be less activity.

Current yes, using run criteria will be faster in most situations. Spawning tasks for parallel systems is currently very single threaded and avoiding the cost of that spawning will be faster with a simple run criteria check. You can see some of this in the run criteria benches I added. But the executor is currently undergoing some changes for stageless and I expect that we'll end up with a design that will spawn tasks while running the other systems. In that model it'll be more dependent on where your bottlenecks are. For example if you are bottlenecked by a long running system, the overhead of spawning a task during that time would have no effect on the actual execution time of a frame.

Definitely makes sense to add spans for run criteria in case someone makes a complicated one. I'll add them if someone else doesn't beat me to it.

@SUPERCILEX
Copy link
Contributor Author

Thanks for the great explanation! :)

@bors bors bot closed this as completed in 9a54e2b May 10, 2022
robtfm pushed a commit to robtfm/bevy that referenced this issue May 17, 2022
# Objective

Adds a tracing span for run critieria.

This change will be invalidated by stageless, but it was a simple change.

Fixes bevyengine#4681.

## Changelog

Shows how long a run criteria takes to run when tracing is enabled.
![image](https://user-images.githubusercontent.com/2180432/167517447-93dba7db-8c85-4686-90e0-30e9636f120f.png)
exjam pushed a commit to exjam/bevy that referenced this issue May 22, 2022
# Objective

Adds a tracing span for run critieria.

This change will be invalidated by stageless, but it was a simple change.

Fixes bevyengine#4681.

## Changelog

Shows how long a run criteria takes to run when tracing is enabled.
![image](https://user-images.githubusercontent.com/2180432/167517447-93dba7db-8c85-4686-90e0-30e9636f120f.png)
ItsDoot pushed a commit to ItsDoot/bevy that referenced this issue Feb 1, 2023
# Objective

Adds a tracing span for run critieria.

This change will be invalidated by stageless, but it was a simple change.

Fixes bevyengine#4681.

## Changelog

Shows how long a run criteria takes to run when tracing is enabled.
![image](https://user-images.githubusercontent.com/2180432/167517447-93dba7db-8c85-4686-90e0-30e9636f120f.png)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Enhancement A new feature S-Needs-Triage This issue needs to be labelled
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants