perf!: improved sorted behaviour collector by using binary insertion to reduce performance impact
This commit is contained in:
@@ -56,12 +56,13 @@ public class ActiveBehaviourCollector<T> : IBehaviourCollector<T> where T : clas
|
||||
OnBehaviourStateChanged(tBehaviour, new(!tBehaviour.IsActive));
|
||||
}
|
||||
|
||||
protected virtual void AddBehaviour(T behaviour) => activeBehaviours.Add(behaviour);
|
||||
private void OnBehaviourStateChanged(IActive sender, IActive.ActiveChangedArguments args)
|
||||
{
|
||||
T behaviour = monitoringActiveToBehaviour[sender];
|
||||
if (sender.IsActive)
|
||||
{
|
||||
activeBehaviours.Add(behaviour);
|
||||
AddBehaviour(behaviour);
|
||||
OnBehaviourAdd(behaviour);
|
||||
OnCollected?.Invoke(this, new(behaviour));
|
||||
}
|
||||
|
Reference in New Issue
Block a user