diff --git a/src/core/Akka/Actor/FSM.cs b/src/core/Akka/Actor/FSM.cs index c1dd1017978..71482a5a3da 100644 --- a/src/core/Akka/Actor/FSM.cs +++ b/src/core/Akka/Actor/FSM.cs @@ -1262,12 +1262,14 @@ private void MakeTransition(State nextState) { Sender.Tell(nextState.Replies[i]); } - if (!_currentState.StateName.Equals(nextState.StateName) || nextState.Notifies) + + // avoid boxing + if (!EqualityComparer.Default.Equals(_currentState.StateName, nextState.StateName) || nextState.Notifies) { _nextState = nextState; HandleTransition(_currentState.StateName, nextState.StateName); Listeners.Gossip(new Transition(Self, _currentState.StateName, nextState.StateName)); - _nextState = default(State); + _nextState = default; } _currentState = nextState;