mirror of
https://github.com/bevyengine/bevy
synced 2025-01-08 19:29:04 +00:00
feac2c206c
# Objective * `World::init_resource` and `World::get_resource_or_insert_with` are implemented naively, and as such they perform duplicate `TypeId -> ComponentId` lookups. * `World::get_resource_or_insert_with` contains an additional duplicate `ComponentId -> ResourceData` lookup. * This function also contains an unnecessary panic branch, which we rely on the optimizer to be able to remove. ## Solution Implement the functions using engine-internal code, instead of combining high-level functions. This allows computed variables to persist across different branches, instead of being recomputed. |
||
---|---|---|
.. | ||
blob_vec.rs | ||
mod.rs | ||
resource.rs | ||
sparse_set.rs | ||
table.rs |