Electroid/SportPaper

Chunk unload takes O(n) instead of O(1)

Electroid opened this issue · 2 comments

This patch makes chunk unloading O(n) by using a LongArraySet instead of being O(1), this means the server slows down considerably the more getChunk calls occur and the more chunks get on the unload queue, this had been fixed in #19 and is a bug that got reintroduced in this pr

Next time when editing lines that already have a // sportpaper comment be more caureful about editing them and lookup the original patches to see why they were already changed, don't mindlessly override the previous changes

Originally posted by @Pablete1234 in #73 (comment)

This was changed because of a crash caused by the fastutil patch.

We need to investigate the cause of the crash and fix it.

The original change was to migrate to fast util collections, as seen in:
https://github.com/Electroid/SportPaper/blob/master/patches/server/0176-Use-fast-util-collections.patch

The issue is that it migrated to a LongArraySet, which is a performance issue, and, in #19, it was fixed by introducing:
4d63808#diff-8b64ebdf0e0949225a0d0109c31243017b5e8c0d6ea4e6abfd3650c1df8a22ff

which changes it from a LongArraySet into a LongOpenHashSet, which solves the performance issue

Later in #73 , it was, again, changed back to the old LongArraySet which kills server performance