bevy/crates/bevy_ecs/src/system
Brian Reavis 795e273a9a
Don't create errors for ignored failed commands (#19718)
# Objective

1. Reduce overhead from error handling for ECS commands that
intentionally ignore errors, such as `try_despawn`. These commands
currently allocate error objects and pass them to a no-op handler
(`ignore`), which can impact performance when many operations fail.

2. Fix a hang when removing `ChildOf` components during entity
despawning. Excessive logging of these failures can cause significant
hangs (I'm noticing around 100ms).
    - Fixes https://github.com/bevyengine/bevy/issues/19777
    - Fixes https://github.com/bevyengine/bevy/issues/19753

<img width="1387" alt="image"
src="https://github.com/user-attachments/assets/5c67ab77-97bb-46e5-b287-2c502bef9358"
/>


## Solution

* Added a `ignore_error` method to the `HandleError` trait to use
instead of `handle_error_with(ignore)`. It swallows errors and does not
create error objects.
* Replaced `remove::<ChildOf>` with `try_remove::<ChildOf>` to suppress
expected (?) errors and reduce log noise.

## Testing

- I ran these changes on a local project.
2025-06-29 16:34:20 +00:00
..
commands Don't create errors for ignored failed commands (#19718) 2025-06-29 16:34:20 +00:00
adapter_system.rs ECS: put strings only used for debug behind a feature (#19558) 2025-06-18 20:15:25 +00:00
builder.rs Stop storing access for all systems (#19477) 2025-06-13 17:56:09 +00:00
combinator.rs ECS: put strings only used for debug behind a feature (#19558) 2025-06-18 20:15:25 +00:00
exclusive_function_system.rs ECS: put strings only used for debug behind a feature (#19558) 2025-06-18 20:15:25 +00:00
exclusive_system_param.rs refactor(utils): move SyncCell and SyncUnsafeCell to bevy_platform (#19305) 2025-05-27 04:57:26 +00:00
function_system.rs ECS: put strings only used for debug behind a feature (#19558) 2025-06-18 20:15:25 +00:00
input.rs Rename Trigger to On (#19596) 2025-06-12 18:22:33 +00:00
mod.rs Upgrade to Rust 1.88 (#19825) 2025-06-26 19:38:19 +00:00
observer_system.rs Add newlines before impl blocks (#19746) 2025-06-22 23:07:02 +00:00
query.rs Remove 's lifetime from WorldQuery::Fetch (#19720) 2025-06-19 00:58:21 +00:00
schedule_system.rs ECS: put strings only used for debug behind a feature (#19558) 2025-06-18 20:15:25 +00:00
system_name.rs Fix issue 19734: add dependency on bevy_utils for the bevy_ecs test. (#19738) 2025-06-21 15:05:04 +00:00
system_param.rs Add newlines before impl blocks (#19746) 2025-06-22 23:07:02 +00:00
system_registry.rs Fix issue 19734: add dependency on bevy_utils for the bevy_ecs test. (#19738) 2025-06-21 15:05:04 +00:00
system.rs Fix issue 19734: add dependency on bevy_utils for the bevy_ecs test. (#19738) 2025-06-21 15:05:04 +00:00