-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MP] Various performance optimizations #82777
Conversation
CC @DennisManaa |
Many thanks for addressing this issue :) This PR looks great 🎉 Unfortunately, I won't be able to look into this topic until next Tuesday/Wednesday because I'm currently on vacation. But it will be the first thing I'll do when I'm home again :) |
@Faless, I just wanted to let you know that I can confirm the performance benefits of your changes. Additionally, I didn't notice any further problems while testing them with our game. I measured the cycles for the last commit in this PR and for the last commit before the changes in this PR (commit 0ca8542). It seems that you reduced the needed cycles for Here are the results of my measurements:
BeforeAfter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just did a code style review.
This was successfully tested, and the implementation changes seem sensible, so I think this can be merged.
Only use paths during network transfer. Use ObjectID instead of NodePaths for storing the Node <-> NetID relations locally.
We already know which MultiplayerAPI a certain Node uses, so we don't need to retrieve it via SceneTree every time.
Access the various internal components (cache/replicator) via pointer, to avoid unnecessary overhead.
Use direct pointer addressing to avoid unnecessary refs/unrefs
Thanks! |
As pointed out in #81593 , watched/on change variables are quite heavy on the CPU side, mostly due to the way network IDs are exchanged and stored for non-spawned node.
This PR introduce a series of optimizations to reduce the computational cost of the replication system:
ObjectID
s locally, while still transferring relative paths).Closes #81593 , might need some more testing.