descendant_count() rebuilds a forward-adjacency HashMap from scratch on every call. deprioritized_tasks() calls this once per tick per task when cascade routing is enabled. For K roots × N tasks this is O(K*(N+E)) per tick. Fix: cache the forward adjacency in CascadeDetector and invalidate on reset().
descendant_count() rebuilds a forward-adjacency HashMap from scratch on every call. deprioritized_tasks() calls this once per tick per task when cascade routing is enabled. For K roots × N tasks this is O(K*(N+E)) per tick. Fix: cache the forward adjacency in CascadeDetector and invalidate on reset().