bevy/crates/bevy_render
James Liu f26b438c22
Cache the QueryState used to drop swapchain TextureViews (#11781)
# Objective
While profiling around to validate the results of #9172, I noticed that
`present_frames` can take a significant amount of time. Digging into the
cause, it seems like we're creating a new `QueryState` from scratch
every frame. This involves scanning the entire World's metadata instead
of just updating its view of the world.

## Solution
Use a `SystemState` argument to cache the `QueryState` to avoid this
construction cost.

## Performance
Against `many_foxes`, this seems to cut the time spent in
`present_frames` by nearly almost 2x. Yellow is this PR, red is main.


![image](https://github.com/bevyengine/bevy/assets/3137680/2b02bbe0-6219-4255-958d-b690e37e7fba)
2024-02-09 00:34:04 +00:00
..
macros Inverse missing_docs logic (#11676) 2024-02-03 21:40:55 +00:00
src Cache the QueryState used to drop swapchain TextureViews (#11781) 2024-02-09 00:34:04 +00:00
Cargo.toml Async pipeline compilation (#10812) 2024-02-05 13:50:50 +00:00