Reuse cave biome cache

- Carve scratch keeps one cave biome cache per thread, cleared per chunk
This commit is contained in:
Brian Neumann-Fopiano committed 2026-10-21 19:29:37 -04:00
1 parent 7282a46a26
commit 6ebb700be0
3 files changed
+7 -1

No files matched your search

@@ -102,9 +102,9 @@ public class IrisCarveModifier extends EngineAssignedModifier<NativeBlockState>
PrecisionStopwatch caveStopwatch = PrecisionStopwatch.start();
Mantle<Matter> mantle = getEngine().getMantle().getMantle();
CaveInputs resolverState = new CaveInputs(getEngine());
Long2ObjectOpenHashMap<IrisBiome> caveBiomeCache = new Long2ObjectOpenHashMap<>(2048);
IrisCarveScratch scratch = SCRATCH.get();
scratch.reset();
Long2ObjectOpenHashMap<IrisBiome> caveBiomeCache = scratch.caveBiomeCache;
CarveWallBuffer walls = scratch.walls;
CarveColumnMask[] columnMasks = scratch.columnMasks;
CarveColumnMask[] boundaryMasks = scratch.boundaryMasks;
@@ -21,6 +21,7 @@ package art.arcane.iris.generation.stage;
import art.arcane.iris.generation.biome.IrisBiome;
import art.arcane.volmlib.util.matter.MatterCavern;
import art.arcane.volmlib.util.math.PowerOfTwoCoordinates;
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
import java.util.Arrays;
import java.util.HashMap;
@@ -32,6 +33,7 @@ final class IrisCarveScratch {
final int[] surfaceHeights = new int[256];
final CarveWallBuffer walls = new CarveWallBuffer(512);
final Map<String, IrisBiome> customBiomeCache = new HashMap<>();
final Long2ObjectOpenHashMap<IrisBiome> caveBiomeCache = new Long2ObjectOpenHashMap<>(4096);
int[] upperSurfaceHeights;
boolean customCaveBiomePresent;
@@ -56,6 +58,7 @@ final class IrisCarveScratch {
}
walls.clear();
customBiomeCache.clear();
caveBiomeCache.clear();
customCaveBiomePresent = false;
}
}