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

Poor performance in bench_players example. #323

Open
rj00a opened this issue Apr 23, 2023 · 1 comment
Open

Poor performance in bench_players example. #323

rj00a opened this issue Apr 23, 2023 · 1 comment
Labels
bug Something isn't working high priority Should be prioritized

Comments

@rj00a
Copy link
Member

rj00a commented Apr 23, 2023

Valence Version

abf9064

What You Did

The bench_players example is indicating poor performance. This is running in release mode without any players connected:

Tick=10, MSPT=8.1462ms, Clients=0
Tick=20, MSPT=7.8771ms, Clients=0
Tick=30, MSPT=7.8221ms, Clients=0
Tick=40, MSPT=7.7786ms, Clients=0
Tick=50, MSPT=7.8106ms, Clients=0
Tick=60, MSPT=8.5027ms, Clients=0
Tick=70, MSPT=8.0414ms, Clients=0
Tick=80, MSPT=8.5672ms, Clients=0
Tick=90, MSPT=7.6703ms, Clients=0

But the idle_update benchmark is under similar conditions, and seems to suggest that a tick should take ~300 microseconds.

idle_update             time:   [378.47 µs 380.01 µs 381.72 µs]
                        change: [-5.5286% -1.2899% +3.5451%] (p = 0.63 > 0.05)

What Went Wrong

The bench_players example should have a MSPT similar to the idle_update benchmark, but it does not.

Additional Information

cargo flamegraph does not seem to indicate anything. Possibly a bug in the app's runner?

@rj00a rj00a added the bug Something isn't working label Apr 23, 2023
@rj00a rj00a added the high priority Should be prioritized label Jun 19, 2023
@rj00a
Copy link
Member Author

rj00a commented Jun 21, 2023

Updating to bevy 0.11-dev in #392 improved the situation significantly, but there's still an unacceptably high MSPT here.

Tick=10, MSPT=2.5595ms, Clients=0
Tick=20, MSPT=2.6124ms, Clients=0
Tick=30, MSPT=2.4096ms, Clients=0
Tick=40, MSPT=2.7876ms, Clients=0
Tick=50, MSPT=2.5686ms, Clients=0
Tick=60, MSPT=2.3812ms, Clients=0
Tick=70, MSPT=2.3343ms, Clients=0
Tick=80, MSPT=2.7529ms, Clients=0
Tick=90, MSPT=2.5710ms, Clients=0
Tick=100, MSPT=1.7957ms, Clients=0
Tick=110, MSPT=2.4565ms, Clients=0
Tick=120, MSPT=0.8715ms, Clients=0

However, for some strange reason, if I have singleplayer Minecraft open on my machine at the same time I'm running bench_players, the performance actually improves.

Tick=10, MSPT=0.5308ms, Clients=0
Tick=20, MSPT=0.6093ms, Clients=0
Tick=30, MSPT=0.9646ms, Clients=0
Tick=40, MSPT=0.7730ms, Clients=0
Tick=50, MSPT=0.6068ms, Clients=0
Tick=60, MSPT=0.8253ms, Clients=0
Tick=70, MSPT=0.7890ms, Clients=0
Tick=80, MSPT=0.6498ms, Clients=0
Tick=90, MSPT=1.0591ms, Clients=0
Tick=100, MSPT=0.6587ms, Clients=0
Tick=110, MSPT=0.9885ms, Clients=0
Tick=120, MSPT=0.9323ms, Clients=0
Tick=130, MSPT=0.8012ms, Clients=0
Tick=140, MSPT=0.8606ms, Clients=0
Tick=150, MSPT=0.8374ms, Clients=0

Maybe something to do with the way the OS is scheduling the process?

I'm more inclined to believe what criterion is telling me now, but something still seems wrong here.

rj00a added a commit that referenced this issue Jun 21, 2023
## Description

- Update to a recent development version of bevy 0.11 in an effort to
solve #323.
- Resolve footgun with event loop by moving it to a dedicated schedule
that runs after `PreUpdate`.
- Miscellaneous code quality improvements.
- Disable `dump_schedule` tool because it's stuck on bevy 0.10.
@rj00a rj00a linked a pull request Feb 11, 2024 that will close this issue
11 tasks
@andrewgazelka andrewgazelka mentioned this issue Mar 17, 2024
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working high priority Should be prioritized
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant