bevy-performance
Installation
SKILL.md
Bevy performance
When to use
Load this when a system is slow or assets stay in memory. Pair it with bevy-debugging-profiling for the counters.
ECS shape
- Systems: the ECS page says systems run in parallel when they can.
.chain()forces order and removes that parallelism for the chained set. Put.chain()only on the systems that must see each other's writes. - Fixed step: movement and other gameplay that should not follow the render frame belong on
Fixed/FixedMain(bevy::time), not on everyUpdate. - Measures:
FrameTimeDiagnosticsPluginrecords frame time, fps, and frame count.EntityCountDiagnosticsPluginrecords entity count.SystemInformationDiagnosticsPluginrecords processcpu_usageandmem_usage.LogDiagnosticsPluginprints them. No target milliseconds are stated on those pages. - Memory:
Handleis reference counted. A strong handle kept in a long-livedResourcekeeps the asset. The last strong drop removes it fromAssets<T>.Assets::adddoes not deduplicate procedural assets.AssetServer::loadreuses a handle while one remains. - Schedule: diagnostics plugins are added on the
AppafterDefaultPlugins. Do not invent a budget resource.
Scope
Chain only the systems that share a mutable query. Read frame diagnostics from DiagnosticsStore. Keep a strong Handle in a resource only while the asset must stay loaded. Changed<T> skips entities whose component did not change this tick.