Revert "Optimize iteration in reference chunk loader"
This commit is contained in:
+5
-16
@@ -218,23 +218,11 @@ public class ReferenceCountingChunkLoader {
|
|||||||
|
|
||||||
final ReferenceCountData[] toRemoveTicket = new ReferenceCountData[1];
|
final ReferenceCountData[] toRemoveTicket = new ReferenceCountData[1];
|
||||||
|
|
||||||
final it.unimi.dsi.fastutil.longs.LongIterator sectionsIterator = currentRegion.getOwnedSectionsUnsynchronised();
|
for (ConcurrentChainedLong2ReferenceHashTable.TableEntry<ReferenceCountData> counterEntry : this.referenceCounters.entrySet()) {
|
||||||
while (sectionsIterator.hasNext()) {
|
final long coord = counterEntry.getKey();
|
||||||
final long sectionKey = sectionsIterator.nextLong();
|
final ReferenceCountData counterData = counterEntry.getValue();
|
||||||
final int sectionX = CoordinateUtils.getChunkX(sectionKey);
|
|
||||||
final int sectionZ = CoordinateUtils.getChunkZ(sectionKey);
|
|
||||||
|
|
||||||
final int chunkX = sectionX << this.world.regioniser.sectionChunkShift;
|
if (currentRegion == this.world.regioniser.getRegionAtUnsynchronised(CoordinateUtils.getChunkX(coord), CoordinateUtils.getChunkZ(coord))) {
|
||||||
final int chunkZ = sectionZ << this.world.regioniser.sectionChunkShift;
|
|
||||||
final long coord = CoordinateUtils.getChunkKey(chunkX, chunkZ);
|
|
||||||
final ReferenceCountData counterData = this.referenceCounters.get(coord);
|
|
||||||
|
|
||||||
// removed
|
|
||||||
if (counterData == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// do ttl
|
|
||||||
long curr = counterData.referenceTTL.get();
|
long curr = counterData.referenceTTL.get();
|
||||||
if (curr == (curr = counterData.referenceTTL.compareAndExchange(curr, curr - 1))) {
|
if (curr == (curr = counterData.referenceTTL.compareAndExchange(curr, curr - 1))) {
|
||||||
if (counterData.referenceCount.get() != 0L) {
|
if (counterData.referenceCount.get() != 0L) {
|
||||||
@@ -262,6 +250,7 @@ public class ReferenceCountingChunkLoader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static final class ReferenceCountData {
|
private static final class ReferenceCountData {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user