Skip to content

Improve BevyLinesRenderBackend performance - #700

Open
IceSentry wants to merge 2 commits into
dimforge:masterfrom
IceSentry:debug_render_perf
Open

Improve BevyLinesRenderBackend performance#700
IceSentry wants to merge 2 commits into
dimforge:masterfrom
IceSentry:debug_render_perf

Conversation

@IceSentry

Copy link
Copy Markdown

The drawing enabled check is currently done just before drawing a line, but the filter_object can return much earlier than that. I have a scene with thousands of complex collider that were using ColliderDebug::NeverRender but the debug renderer still had to go through each edges of each of those objects before returning. With this change it now filters early any entities that have drawing disabled. In my scene I went from 15fps back to vsync.

I also noticed that drawing a polyline would query for the object color for every line segment. So instead of using the default implementation I overloaded it to get the color once per object and draw the lines directly. In my scene, when not filtering any colliders I went from 15fps to 20fps. It's pretty minor, but there's a lot of overhead in multiple places and this one was pretty low impact to do. I've been looking into the debug renderer and I have ideas on how to make it perform better when rendering a lot of complex colliders but this will take multiple more complex PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant