You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore: Improve performance of NetworkList set operation (#3587)
continues: #3585
This PR adds an equality check to the `NetworkList<T>` indexer setter,
aligning its behavior with `NetworkVariable<T>.Value`. Since
`NetworkList<T>` already constrains `T` to `IEquatable<T>`, this change
is both safe and broadly applicable. It avoids redundant assignments
when the new value is equal to the current value, which improves runtime
efficiency and avoids unnecessary event dispatch and network
synchronization.
## Changelog
- Changed: Optimized `NetworkList<T>` indexer setter to skip operations
when the new value equals the existing value, improving performance by
avoiding unnecessary list events and network synchronization.
## Testing & QA
This is a very small optimization in an area of code that is deeply
covered by unit and integration tests. No manual testing is required.
## Documentation
As there are no API or behaviour changes, no documentation is required
## Backport
This is a new optimization and so doesn't need to be backported
---------
Co-authored-by: Yuto Harada <[email protected]>
Copy file name to clipboardExpand all lines: com.unity.netcode.gameobjects/CHANGELOG.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,8 @@ Additional documentation and release notes are available at [Multiplayer Documen
19
19
20
20
### Changed
21
21
22
+
- Optimized `NetworkList<T>` indexer setter to skip operations when the new value equals the existing value, improving performance by avoiding unnecessary list events and network synchronization. (#3587)
0 commit comments