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.
This commit includes two performance fixes that have been beneficial on our server. However, these changes on one server may not be the experience for everyone (and thus be beneficial to merge into upstream). We hope by opening this PR we can get some more people to test locally, and (maybe even on their server)!
The two changes we provide in this (besides a pom.xml change for ProtocolLib so it can build locally on a fresh box where the dependencies aren't cached) are:
Collections.shuffle
. The reason for using fisher-yates instead ofCollections.shuffle
were described originally when I was working on the original 13.1 PR, but I'll copy it here for those who don't want to go find it or didn't follow it):All in all it means one less place we allocate objects that just get GC'd on the next GC run, while still keeping the O(N) nature of
Collections.shuffle
(so we're not taking a perf hit in time, just helping GC run faster!)Although CRC-32 is relatively fast when compared to something like MD5, it still isn't really what we're looking for. Which is a non cryptographic high throughput hash. For here we turn to xxHash (specifically xxHash64), which is considered one of the fastest hashes available without sacrificing quality. This statement is specifically coming from multiple SMHasher (the de-facto hash tester these days) results. 1 2 3 4.
Obviously though what everyone else tests with won't map to anyone. Really what we wanna see is if it makes the experience better for a noticeable amount of users. Cause then it might be worth merging it in (or at the very least making it an option).