Restored saved dimensions off-thread

- Saved Iris dimensions are prepared in parallel during world load (server-about-to-start on NeoForge and Forge, server-starting on Fabric), before the server watchdog runs
- Server start only creates the restored levels, builds their engines in parallel, and publishes them, so its wait no longer grows one world at a time
- Each restored dimension opens its generation history once instead of twice and resolves its active pack once instead of three times
- An epoch snapshot whose content matches its validated source pack reuses that validation instead of running the full pack validator for every world
- Level creation reads the configured pack and structure biome keys from data warmed during preparation
- Immutable generation packs feed the prepared hydrology cache identity from the data's memoized fingerprint instead of hashing the pack twice per engine build
- Restore logging reports each dimension's preparation and engine time and how long the server thread waited
This commit is contained in:
Brian Neumann-Fopiano committed 2026-10-15 10:08:51 -04:00
1 parent 0ca33068f3
commit 62c610ce76
13 files changed
+1118 -223

No files matched your search

@@ -30,9 +30,12 @@ record PreparedHydrologyCacheIdentity(String fingerprint) {
if (context.isBlank()) {
return null;
}
String content = GenerationPackFingerprint.compute(
target.getData().getDataFolder().toPath(), GenerationPackFingerprint.CURRENT_VERSION);
String dependencies = target.getData().hasGenerationRegistryContract() ? "closed"
boolean immutable = target.getData().hasGenerationRegistryContract();
String content = immutable
? target.getData().generationPackFingerprint()
: GenerationPackFingerprint.compute(
target.getData().getDataFolder().toPath(), GenerationPackFingerprint.CURRENT_VERSION);
String dependencies = immutable ? "closed"
: dependencyFingerprint(IrisPlatforms.get().packsFolderNoCreate());
if (dependencies.isBlank()) {
return null;
@@ -1,6 +1,7 @@
package art.arcane.iris.generation.runtime;
import art.arcane.iris.world.history.GenerationKernelRegistry;
import art.arcane.iris.world.history.GenerationPackFingerprint;
import art.arcane.iris.world.history.TransitionGenerationPlan;
import org.junit.Test;
import org.junit.Rule;
@@ -21,6 +22,7 @@ import static org.mockito.Mockito.mockStatic;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -121,6 +123,8 @@ public class PreparedHydrologyCacheIdentityTest {
IrisData data = mock(IrisData.class);
when(data.getDataFolder()).thenReturn(path.toFile());
when(data.hasGenerationRegistryContract()).thenReturn(true);
when(data.generationPackFingerprint()).thenAnswer(invocation ->
GenerationPackFingerprint.compute(path, GenerationPackFingerprint.CURRENT_VERSION));
IrisWorld world = mock(IrisWorld.class);
when(world.minHeight()).thenReturn(-64);
when(world.maxHeight()).thenReturn(320);
@@ -133,6 +137,23 @@ public class PreparedHydrologyCacheIdentityTest {
return target;
}
@Test
public void immutableGenerationPackUsesTheDataFingerprintWithoutRereadingThePack() throws Exception {
Path missing = folder.getRoot().toPath().resolve("immutable-epoch-pack");
EngineTarget target = target(missing);
IrisData data = target.getData();
doReturn("verified-epoch").when(data).generationPackFingerprint();
GenerationKernelRegistry.RuntimeKernel kernel = kernel("implementation");
try (MockedStatic<PackValidationCache> validation = mockStatic(PackValidationCache.class)) {
validation.when(PackValidationCache::contextFingerprint).thenReturn("platform");
PreparedHydrologyCacheIdentity captured = PreparedHydrologyCacheIdentity.capture(target, kernel, null, false);
assertEquals(PreparedHydrologyCacheIdentity.fromInputs(
"verified-epoch", "closed", "platform", kernel, null, -64, 320, 0), captured);
}
}
@Test
public void identicalInputsShareRegardlessOfWorldLocation() {
GenerationKernelRegistry.RuntimeKernel kernel = kernel("implementation");