Commit 3dcc65a
fix: Removed unnecessary GC Allocation (#3527)
Fix for [MTTB-85](https://jira.unity3d.com/browse/MTTB-85) removed the
use of a foreach causing an unnecessary GC Allocation.
Did a full sweep of internal `NetworkManager.ConnectedClientsIds` and
replaced with either `for` loop or directly referencing the
`NetworkConnectionManager.ConnectedClientIds`.
## Changelog
- Fixed: Issue with unnecessary internal GC Allocations when using the
`IReadOnlyList` `NetworkManager.ConnectedClientsIds` within a `foreach`
statement by either replacing with a `for` loop or directly referencing
the `NetworkConnectionManager.ConnectedClientIds`.
## Documentation
- No documentation updates were required.
## Testing & QA
[//]: # (
This section is REQUIRED and should describe how the changes were tested
and how should they be tested when Playtesting for the release.
It can range from "edge case covered by unit tests" to "manual testing
required and new sample was added".
Expectation is that PR creator does some manual testing and provides a
summary of it here.)
### Functional Testing
[//]: # (If checked, List manual tests that have been performed.)
_Manual testing :_
- [X] `Manual testing done`
- Tested manually before and after fix to confirm the allocation was
present and then absent.
_Automated tests:_
- [ ] `Covered by existing automated tests`
- [ ] `Covered by new automated tests`
_Does the change require QA team to:_
- [ ] `Review automated tests`?
- [ ] `Execute manual tests`?
If any boxes above are checked, please add QA as a PR reviewer.
## Backport
The backport of this PR is #3601
---------
Co-authored-by: NoelStephensUnity <[email protected]>1 parent 46fa369 commit 3dcc65a
File tree
18 files changed
+37
-29
lines changed- com.unity.netcode.gameobjects
- Runtime
- Components
- Connection
- Core
- Messaging
- Messages
- RpcTargets
- SceneManagement
- Spawning
- Transports/UTP
18 files changed
+37
-29
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
996 | 996 | | |
997 | 997 | | |
998 | 998 | | |
999 | | - | |
| 999 | + | |
1000 | 1000 | | |
1001 | 1001 | | |
1002 | 1002 | | |
| |||
1315 | 1315 | | |
1316 | 1316 | | |
1317 | 1317 | | |
1318 | | - | |
| 1318 | + | |
1319 | 1319 | | |
1320 | 1320 | | |
1321 | 1321 | | |
| |||
1378 | 1378 | | |
1379 | 1379 | | |
1380 | 1380 | | |
1381 | | - | |
| 1381 | + | |
1382 | 1382 | | |
1383 | 1383 | | |
1384 | 1384 | | |
| |||
1452 | 1452 | | |
1453 | 1453 | | |
1454 | 1454 | | |
1455 | | - | |
| 1455 | + | |
1456 | 1456 | | |
1457 | 1457 | | |
1458 | 1458 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
152 | | - | |
| 152 | + | |
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
157 | | - | |
| 157 | + | |
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1616 | 1616 | | |
1617 | 1617 | | |
1618 | 1618 | | |
1619 | | - | |
| 1619 | + | |
1620 | 1620 | | |
1621 | 1621 | | |
1622 | 1622 | | |
| |||
2363 | 2363 | | |
2364 | 2364 | | |
2365 | 2365 | | |
2366 | | - | |
| 2366 | + | |
2367 | 2367 | | |
2368 | 2368 | | |
2369 | 2369 | | |
| |||
2382 | 2382 | | |
2383 | 2383 | | |
2384 | 2384 | | |
2385 | | - | |
| 2385 | + | |
2386 | 2386 | | |
2387 | 2387 | | |
2388 | 2388 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
253 | | - | |
| 253 | + | |
254 | 254 | | |
| 255 | + | |
255 | 256 | | |
256 | 257 | | |
257 | 258 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
250 | | - | |
| 250 | + | |
251 | 251 | | |
252 | | - | |
| 252 | + | |
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
194 | | - | |
| 194 | + | |
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
231 | | - | |
| 231 | + | |
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| |||
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| 31 | + | |
29 | 32 | | |
30 | 33 | | |
31 | 34 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| |||
0 commit comments