-
-
Notifications
You must be signed in to change notification settings - Fork 68
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
Performance optimizations: Pathfinder ~70x faster, also improved general tick speed #1474
base: master-1.21
Are you sure you want to change the base?
Conversation
… speed with lots of devices (17 ms to 3 ms in test scene)
Thanks for this @Lssikkes! It has been on my todo-list for a long time to look into such large-scale performance analysis, but you beat me to it :-) I will have a more detailed look at this PR in the near future. |
Unfortunately not automated, I just added worldedit and started creating a few large slabs with //set integrateddynamics:cable .. And then pointed VisualVM at it. With worldedit it still lags a lot because for every block placement it does, it will recalculate the whole network. Probably something to be done there that it defers network updates until post tick, and then check if the blocks have already been touched or so, to prevent it from going that wild. But it doesn't happen in normal gameplay too much (except when detonating a TNT/creeper inside the dense cable grid, that'll create similar performance issues), so I don't think it's of the highest priority. Here's my save: |
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.
I just have one possible suggestion. Everything else looks perfect to be merged!
@@ -107,7 +107,7 @@ public void onWorldTick() { | |||
this.states.remove(oldPosition); | |||
this.instances.remove(oldPosition); | |||
} | |||
this.oldPositions = Sets.newHashSet(newPositions); | |||
this.oldPositions = (Set<PartPos>)newPositions; |
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.
Instead of the cast, we can probably change the signature of the getPositions
method.
Unless you see a specific reason for doing it like this? (not needed for backwards-compat, as no other mods are calling getPositions
)
Before:

(tick 12-15 ms, destroying one block 7000 ms stall on server)
After:

(tick 4-5 ms, destroying one block 117 ms stall on server)