-
Yesterday I tried to port a tile editor GUI from egui to bevy using the bevy egui plugin as a replacement, because I hoped to get a performance boost. The GPU usage is significantly less with bevy, as the editor objects aren't recreated every frame, but when I drag tiles across the screen, there is a pretty large input lag, that isn't pleasant to look at and gives the user the impression that the app is slow and unresponsive. In the video below i removed the gui part to make sure it doesn't cause the problem. I have found a pull request (#6503) that is merged into main, but switching to that branch doesn't fix the problem. Is there any way this can be reduced or fixed completely or did I miss something about the main branch? app.2023-02-10.11-07-22.mp4 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
There is several things you can do to reduce lag:
Setting component valuesAnother source of latency is inserting/removing components. If you are updating a component's value, you should be using a
System orderingFor example, your systems may look like app
.add_system(set_velocity_from_mouse_delta)
.add_system(update_transform); This runs, but if You need to make sure app
.add_system(set_velocity_from_mouse_delta.before(update_transform))
.add_system(update_transform); |
Beta Was this translation helpful? Give feedback.
-
Ohhh, thank you very much, i see that there is a lot of room for improvement in my code now. The system ordering is a point i have completely missed, and i am using the commands.insert function every frame for updating the mouse last position. I will look into framepace as well, thank you very much for all these tips and the quick help 💯 |
Beta Was this translation helpful? Give feedback.
There is several things you can do to reduce lag:
Setting component values
Another source of latency is inserting/removing components. If you are updating a component's value, you should be using a
Query<&mut MyComponent>
instead ofcommands.insert(MyComponent)
.Commands
are applied at the end of a stage, so if you have a system that setsMyComponent
, and another that read its value in the same stage, the reading system will only be able to read the value ofMyComponent
from last…