Skip to content

Commit

Permalink
perf(SocketLayer): adding IEquatable to struct
Browse files Browse the repository at this point in the history
removes allocations from ring buffer comparer
  • Loading branch information
James-Frowen committed Jul 1, 2021
1 parent 5a8cf36 commit f935786
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Assets/Mirage/Runtime/SocketLayer/AckSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ public override int GetHashCode()
return order;
}
}
public struct ReliableReceived
public struct ReliableReceived : IEquatable<ReliableReceived>
{
public readonly ByteBuffer buffer;
public readonly int length;
Expand All @@ -735,6 +735,11 @@ public ReliableReceived(ByteBuffer buffer, int length, bool isFragment)
this.length = length;
this.isFragment = isFragment;
}

public bool Equals(ReliableReceived other)
{
return buffer == other.buffer;
}
}
}
}

0 comments on commit f935786

Please sign in to comment.