Skip to content

Commit

Permalink
Has performance improvement.
Browse files Browse the repository at this point in the history
  • Loading branch information
genaray committed Aug 8, 2024
1 parent 7c15424 commit 3a3c41d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Arch/Core/Chunk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ public void Set<T>(int index, in T cmp)
public bool Has<T>()
{
var id = Component<T>.ComponentType.Id;
return id < ComponentIdToArrayIndex.Length && ComponentIdToArrayIndex[id] != -1;
var idToArrayIndex = ComponentIdToArrayIndex;
return id < idToArrayIndex.Length && idToArrayIndex.DangerousGetReferenceAt(id) != -1;
}

/// <summary>
Expand Down

0 comments on commit 3a3c41d

Please sign in to comment.