Only consider chunks Loaded if at BORDER status#4320
Merged
Conversation
Member
Author
|
Updated test build with fix for the only reported crash so far. This specific detail wasnt the important part of testing, so took this one change out for now to keep build stable so we can test the important stuff https://cdn.discordapp.com/attachments/748269415497465927/754945012080312370/loaded-chunks-r2.jar |
unisteven
reviewed
Sep 17, 2020
This greatly improves performance as it drastically reduces the amount of Entities and Tile Entities that are "registered" into the world, as purely "cached" chunks will no longer have their entities hanging out in the world. Additionally this fixes our Entity Add To World and Entity Remove From World events Those events have not been firing correctly since MC changed how chunks work here. Now the server will only consider a chunk "loaded" if it's got a ticket putting it at level 33 or lower, which matches the public Bukkit API.
Adds final to some methods to improve inlining ability
a50fd75 to
a183920
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DOWNLOAD LINK: https://cdn.discordapp.com/attachments/748269415497465927/754945012080312370/loaded-chunks-r2.jar
While initial smoke test looks to be ok, this build presents a high risk of entity and tile entity lost if there is a bug that I did not see in my own testing.
It is super imperative that you have backups before testing this!
This greatly improves performance as it drastically reduces the amount
of Entities and Tile Entities that are "registered" into the world, as
purely "cached" chunks will no longer have their entities hanging out in the world.
Additionally this fixes our Entity Add To World and Entity Remove From World events
Those events have not been firing correctly since MC changed how chunks work here.
Now the server will only consider a chunk "loaded" if it's got a ticket putting
it at level 33 or lower, which matches the public Bukkit API.
Before this, there are a ton of chunks in memory in a 'cached' state, they aren't considered "loaded" in the api, they arent in any players view distance, are not force loaded.
When they are loaded and unloaded don't align with our expectation of "load/unload" events.
Leaving A LOT of extra entities in memory. meaning more entities to iterate for ticking (which will then be "skipped" because not in correct chunk") same with tile entities. also same issue applies for iterating chunks too, iterating far more than will end up being ticked resulting in a lot of checks to then skip it.
This change cuts it out so the iteration only operates on stuff in a loaded state now.