bevy/crates
James Liu 13570cd4c8
Minimize small allocations by dropping the tick Vecs from Resources (#11226)
# Objective
`Column` unconditionally requires three separate allocations: one for
the data, and two for the tick Vecs. The tick Vecs aren't really needed
for Resources, so we're allocating a bunch of one-element Vecs, and it
costs two extra dereferences when fetching/inserting/removing resources.

## Solution
Drop one level lower in `ResourceData` and directly store a `BlobVec`
and two `UnsafeCell<Tick>`s. This should significantly shrink
`ResourceData` (exchanging 6 usizes for 2 u32s), removes the need to
dereference two separate ticks when inserting/removing/fetching
resources, and can significantly decrease the number of small
allocations the ECS makes by default.

This tentatively might have a non-insignificant impact on the CPU cost
for rendering since we're constantly fetching resources in draw
functions, depending on how aggressively inlined the functions are.

This requires reimplementing some of the unsafe functions that `Column`
wraps, but it also allows us to delete a few Column APIs that were only
used for Resources, so the total amount of unsafe we're maintaining
shouldn't change significantly.

---------

Co-authored-by: Joseph <21144246+JoJoJet@users.noreply.github.com>
2024-01-08 22:39:47 +00:00
..
bevy_a11y Add [lints] table, fix adding #![allow(clippy::type_complexity)] everywhere (#10011) 2023-11-18 20:58:48 +00:00
bevy_animation support all types of animation interpolation from gltf (#10755) 2023-12-31 18:01:50 +00:00
bevy_app StateTransitionEvent (#11089) 2024-01-08 22:27:00 +00:00
bevy_asset Add reserve_handle to Assets. (#10939) 2024-01-08 22:17:29 +00:00
bevy_audio Reorder impl to be the same as the trait (#11076) 2023-12-24 17:43:55 +00:00
bevy_core Replace or document ignored doctests (#11040) 2024-01-01 16:50:56 +00:00
bevy_core_pipeline Implement minimal reflection probes. (#10057) 2024-01-08 22:09:17 +00:00
bevy_derive Reexport winit::platform::android::activity::* in bevy_winit (#11011) 2023-12-19 20:15:03 +00:00
bevy_diagnostic Replace or document ignored doctests (#11040) 2024-01-01 16:50:56 +00:00
bevy_dylib Add [lints] table, fix adding #![allow(clippy::type_complexity)] everywhere (#10011) 2023-11-18 20:58:48 +00:00
bevy_dynamic_plugin Add [lints] table, fix adding #![allow(clippy::type_complexity)] everywhere (#10011) 2023-11-18 20:58:48 +00:00
bevy_ecs Minimize small allocations by dropping the tick Vecs from Resources (#11226) 2024-01-08 22:39:47 +00:00
bevy_ecs_compile_fail_tests Rename WorldQueryData & WorldQueryFilter to QueryData & QueryFilter (#10779) 2023-12-12 19:45:50 +00:00
bevy_encase_derive Add [lints] table, fix adding #![allow(clippy::type_complexity)] everywhere (#10011) 2023-11-18 20:58:48 +00:00
bevy_gilrs Remove unnecessary path prefixes (#10749) 2023-11-28 23:43:40 +00:00
bevy_gizmos Fix: Gizmos crash due to the persistence policy being set to Unload. Change it to Keep (#11192) 2024-01-03 11:03:18 +00:00
bevy_gltf assets should be kept on CPU by default (#11212) 2024-01-05 05:53:47 +00:00
bevy_hierarchy Rename "AddChild" to "PushChild" (#11194) 2024-01-04 16:06:14 +00:00
bevy_input Extend Touches with clear and reset methods (#10930) 2024-01-04 23:13:29 +00:00
bevy_internal Implement minimal reflection probes. (#10057) 2024-01-08 22:09:17 +00:00
bevy_log Print to stderr from panic handler in LogPlugin (#11170) 2024-01-01 17:10:20 +00:00
bevy_macro_utils Replace or document ignored doctests (#11040) 2024-01-01 16:50:56 +00:00
bevy_macros_compile_fail_tests Standardize toml format with taplo (#10594) 2023-11-21 01:04:14 +00:00
bevy_math Add new_and_length method to Direction2d and Direction3d (#11172) 2024-01-08 22:36:56 +00:00
bevy_mikktspace Replace calculation with function call (#11077) 2023-12-23 17:32:26 +00:00
bevy_pbr Implement minimal reflection probes. (#10057) 2024-01-08 22:09:17 +00:00
bevy_ptr Simplify equality assertions (#10988) 2023-12-16 23:58:41 +00:00
bevy_reflect Implement TypePath for EntityHash (#11195) 2024-01-04 18:28:31 +00:00
bevy_reflect_compile_fail_tests Fix nested generics in Reflect derive (#10791) 2023-11-29 01:46:09 +00:00
bevy_render Mul<f32> for ScalingMode (#11030) 2024-01-08 22:24:32 +00:00
bevy_scene Change SceneSpawner::spawn_dynamic_sync to return InstanceID (#11239) 2024-01-06 22:26:32 +00:00
bevy_sprite assets should be kept on CPU by default (#11212) 2024-01-05 05:53:47 +00:00
bevy_tasks Replace or document ignored doctests (#11040) 2024-01-01 16:50:56 +00:00
bevy_text Unload render assets from RAM (#10520) 2024-01-03 03:31:04 +00:00
bevy_time Replace or document ignored doctests (#11040) 2024-01-01 16:50:56 +00:00
bevy_transform Rename "AddChild" to "PushChild" (#11194) 2024-01-04 16:06:14 +00:00
bevy_ui Made the remaining types from bevy_ui to reflect the Default trait if… (#11199) 2024-01-03 18:57:05 +00:00
bevy_utils Add static assertions to bevy_utils for compile-time checks (#11182) 2024-01-02 22:08:30 +00:00
bevy_window Remove CanvasParentResizePlugin (#11057) 2023-12-21 20:01:22 +00:00
bevy_winit Fix perf degradation on web builds (#11227) 2024-01-06 19:40:13 +00:00