Skip to content

Commit 137306e

Browse files
committed
Add aggressive inlining
This reduces the overhead of the state machine methods slightly
1 parent cee2a25 commit 137306e

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/StateMachine/StateMachine.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,10 @@ public StateBase<TStateId> ActiveState
159159
/// <summary>
160160
/// Returns true when the state machine is currently running.
161161
/// </summary>
162-
public bool IsInitialized => activeState != null;
162+
public bool IsInitialized {
163+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
164+
get => activeState != null;
165+
}
163166

164167
public IStateTimingManager ParentFsm => fsm;
165168

@@ -185,6 +188,7 @@ public StateMachine(bool needsExitTime = false, bool isGhostState = false, bool
185188
/// Throws an exception if the state machine is not initialized yet.
186189
/// </summary>
187190
/// <param name="context">String message for which action the fsm should be initialized for.</param>
191+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
188192
private void EnsureIsInitializedFor(string context)
189193
{
190194
if (!IsInitialized)

0 commit comments

Comments
 (0)