bevyengine / bevyengine/bevy

`prepare_windows` causing frame pacing issues

Open
#21,833 18 comments 0 reactions 0 assignees View on GitHub
A-Rendering A-Time C-Performance D-Complex I-Regression S-Needs-Investigation
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## Bevy version and features

0.17.2

## \[Optional\] Relevant system information

**OS** Fedora 43
**CPU** Intel i7 - 12700h

```ignore
`AdapterInfo { name: "NVIDIA GeForce RTX 3060 Laptop GPU", vendor: 4318, device: 9568, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "580.95.05", backend: Vulkan }
```
## What you did

I recently migrated my project from 0.16.1 to 0.17.2. When I finished the migration process, I observed a performance change that made the game feel like it was running at a lower FPS.

## What went wrong

If it's not clear, break this out into:

After migrating to 0.17.2, There is now a very noticeable performance hit when running the game.
Multithreading or optimization levels do not seem to have much of an effect on the frametimes.

![Image](https://github.com/user-attachments/assets/dc88cce1-fde0-4850-9bfe-e779864f7a57)
This is a trace screenshot of the reaction_time program running.
It seems that the cause is the function `view::windows::prepare_windows`.

![Image](https://github.com/user-attachments/assets/32c2eaaf-6968-4fde-8285-d677c9c98ff7)
Trace stats of `view::windows::prepare_windows`

## Additional information

I ran tracy on a 0.16 and 0.17 version of my game with tracy.

This was my original game on version 0.16.1:
Image

This is a trace in similar conditions on version 0.17.2:
Image

This is a project I observed the problem on, but a minimal project could possibly recreate the problem.
[reaction_time_demo.tar.gz](https://github.com/user-attachments/files/23539404/reaction_time_demo.tar.gz)

Contributor guide

Open the contributing guide

Research direction

Start with the `view::windows::prepare_windows` entry point and reproduce the report using the attached `reaction_time_demo.tar.gz`. Compare Tracy captures from Bevy 0.16.1 and 0.17.2 under similar conditions, then verify that the frame-pacing regression is resolved and the relevant `prepare_windows` timings improve.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
computer-graphics, game-dev, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.