Brettflan / WorldBorder

Bukkit plugin for maintaining borders for your worlds to limit their sizes, as well as generating missing chunks or trimming excess chunks.
https://www.spigotmc.org/resources/worldborder.60905/
BSD 2-Clause "Simplified" License
139 stars 210 forks source link

Optimize WorldFileData #114

Closed aikar closed 6 years ago

aikar commented 6 years ago

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.

Brettflan commented 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.

Brettflan commented 6 years ago

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