Make PluginHologramManager use HashSet
MedicOP opened this issue ยท 1 comments
Is there any reason why PluginHologramManager uses an ArrayList instead of a HashSet to store the PluginHolograms?
When you have 5000+ holograms with new ones constantly being removed and created, the ArrayList becomes quite the bottleneck
Because I would have to iterate through the Set anyways, to check if each hologram is in a given chunk, and the Set is slower for iteration. The solution would be to use Map<ChunkCoords, List/Set<Hologram>>
, with the map being updated when a hologram is moved to another chunk. Doing so would make adding/removing/iterating proportional to the # of holograms in the chunk, instead of the whole world.