Closed aikar closed 6 years ago
Hmm, looks reasonable and straightforward enough. Not gonna lie though, that header.clear() threw me for a loop until I looked into what that clear() actually does (as opposed to what you'd expect) and how asIntBuffer() initializes based on the current position.
I'll probably test and implement this in a little while when I have the time for it.
After some brief testing, doing a timing profile of the specific section of code with 10 runs on the same initial world and Fill task, 5 runs before and 5 after making the suggested change, it indicated a bit over 5x faster execution of that algorithm in my test environment. Nice.
Went ahead with it. https://github.com/Brettflan/WorldBorder/commit/af4727d1b62de224e9c9476e0006df6b662b7fe5
I see you have your own form of RegionFileCache in WorldBorder
I suggest you apply the following improvement to the code to improve IO performance reading Region Files :)
https://github.com/PaperMC/Paper/blob/b62dfa0bf95ac27ba0fbb3fae18c064e4bb61d50/Spigot-Server-Patches/0086-Reduce-IO-ops-opening-a-new-region-file.patch
This will improve performance.