perf(engine): gate frame-hot ECS systems on resource changes

- find_draggable_at: break instead of return None on non-top non-tableau
  hit so remaining pile searches are not abandoned early (M-9)
- update_stock_count_badge: run only when GameStateResource changes (M-5)
- update_drop_highlights: run only when DragState changes (M-6)
- update_high_contrast_borders/backgrounds: run only when SettingsResource
  changes (M-7)
- update_selection_hud: run only when SelectionState or GameStateResource
  changes; uses resource_exists_and_changed to avoid panic in tests where
  SelectionState is not registered (M-8)
- Volume toast threshold: f32::EPSILON → 0.001 to avoid spurious toasts
  from float rounding noise in settings events (M-10)
- check_no_moves: collapse read().next().is_some() + clear() into a single
  read().count() > 0 drain (M-11)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
funman300
2026-05-17 20:37:01 -07:00
parent 69c6e88188
commit aa7b0f6eed
7 changed files with 21 additions and 11 deletions
+2 -2
View File
@@ -454,8 +454,8 @@ fn handle_settings_toast(
for ev in events.read() {
let sfx = ev.0.sfx_volume;
let music = ev.0.music_volume;
let sfx_changed = last_sfx.is_none_or(|prev| (prev - sfx).abs() > f32::EPSILON);
let music_changed = last_music.is_none_or(|prev| (prev - music).abs() > f32::EPSILON);
let sfx_changed = last_sfx.is_none_or(|prev| (prev - sfx).abs() > 0.001);
let music_changed = last_music.is_none_or(|prev| (prev - music).abs() > 0.001);
*last_sfx = Some(sfx);
*last_music = Some(music);
if sfx_changed {