bevy/crates/bevy_ecs/src/storage
re0312 06738bff63
Remove unnecessary branch in query iteration (#12844)
# Objective

- Since #10811,Bevy uses `assert `in the hot path of iteration. The
`for_each `method has an assert in the outer loop to help the compiler
remove unnecessary branching in the internal loop.
- However , ` for` style iterations do not receive the same treatment.
it still have a branch check in the internal loop, which could
potentially hurt performance.

## Solution

- use `TableRow::from_u32 ` instead of ` TableRow::from_usize` to avoid
unnecessary branch.

Before


![image](https://github.com/bevyengine/bevy/assets/45868716/f6d2a1ac-2129-48ff-97bf-d86713ddeaaf)



After
----------------------------------------------------------------------------


![image](https://github.com/bevyengine/bevy/assets/45868716/bfe5a9ee-ba6c-4a80-85b0-1c6d43adfe8c)
2024-04-02 06:02:56 +00:00
..
blob_vec.rs bevy_ecs address trivial cases of unsafe_op_in_unsafe_fn (#11861) 2024-02-22 00:04:38 +00:00
mod.rs Improve doc formatting. (#9840) 2023-09-18 19:43:56 +00:00
resource.rs bevy_ecs address trivial cases of unsafe_op_in_unsafe_fn (#11861) 2024-02-22 00:04:38 +00:00
sparse_set.rs Use NonMaxUsize for non-component SparseSets (#12083) 2024-03-03 14:55:27 +00:00
table.rs Remove unnecessary branch in query iteration (#12844) 2024-04-02 06:02:56 +00:00