Skip to content

Conversation

@jeffreyrainy
Copy link
Contributor

@jeffreyrainy jeffreyrainy commented Aug 11, 2022

Renames NetwoirkBehaviourUpdater's m_Touched to m_DirtyNetworkObjects
Instead of scanning all spawned objects, for each client, then checking visibility and updating,
we now scan only over the dirty objects and then over all clients for visibility.

Since few objects are dirty, typically, this improves performance.

Changelog

  • Preformance improvements for cases with large number of NetworkObjects, by not iterating over all unchanged NetworkObjects

@jeffreyrainy jeffreyrainy marked this pull request as ready for review August 12, 2022 19:30
@jeffreyrainy jeffreyrainy requested a review from a team as a code owner August 12, 2022 19:30
@jeffreyrainy jeffreyrainy requested a review from a team as a code owner August 15, 2022 13:28
…e-enabling test, making it use SetDirty() properly
Copy link
Member

@NoelStephensUnity NoelStephensUnity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@jeffreyrainy jeffreyrainy merged commit fdb32f1 into develop Aug 16, 2022
@jeffreyrainy jeffreyrainy deleted the perf/improved-performance branch August 16, 2022 18:27
jakobbbb pushed a commit to GooseGirlGames/com.unity.netcode.gameobjects that referenced this pull request Feb 22, 2023
…#2116)

* Performance fix for large number of NetworkObjects

* docs: style: changelog and coding convention

* fixes tests (but not NetworkList ones)

* Fixes NetworkList functionality

* disabling incompatible test

* test adjustment, following improvement in NetworkVariable sending

* Merging two loops to scan over objects one less time (performance). Re-enabling test, making it use SetDirty() properly

* improved naming, fixed tests

* addressing 'This seems like it should be handled by PostNetworkVariableWrite' PR review comment

* refactoring common part to duplicated code paths into a single instance

* limiting m_IsDirty visibility, to encourage using SetDirty()

Co-authored-by: starchitectus <acarija@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants