Merged threads and hydrology

- Bounded hydrology halo, performance-core pools
This commit is contained in:
Brian Neumann-Fopiano committed 2026-10-21 23:14:43 -04:00
commit f283d482a4
6 files changed
+47 -8

No files matched your search

@@ -12,6 +12,7 @@ import java.util.concurrent.ForkJoinTask;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
@@ -60,6 +61,13 @@ public class HydrologyBurstTest {
assertTrue(pool.isTerminated());
}
@Test
public void plannerPoolFollowsThePerformanceCores() {
assertEquals(12, MultiBurst.HydrologyBurst.plannerParallelism(12));
assertEquals(4, MultiBurst.HydrologyBurst.plannerParallelism(1));
assertEquals(32, MultiBurst.HydrologyBurst.plannerParallelism(32));
}
@Test
public void closedHydrologyWorkersTerminateAndReopenCreatesANewPool() throws Exception {
IrisSettings previousSettings = IrisSettings.settings;
@@ -696,6 +696,29 @@ public class HydrologyTileCacheTest {
cache.close();
}
@Test
public void pregenSpeculationStaysWithinTheGenerationReachOfTheArea() {
HydrologyPlanner planner = mock(HydrologyPlanner.class);
HydrologyTile tile = mock(HydrologyTile.class);
HydrologyPlannerSettings settings = stalePrefetchSettings();
when(planner.settings()).thenReturn(settings);
ArrayList<HydrologyTileKey> planned = new ArrayList<>();
doAnswer(invocation -> {
planned.add(invocation.getArgument(0));
return tile;
}).when(planner).plan(any(HydrologyTileKey.class));
HydrologyTileCache cache = new HydrologyTileCache(planner, 128, Runnable::run);
try (HydrologyTileCache.PregenerationScope ignored = cache.preparePregeneration(
new HydrologyTileCache.PregenerationArea(1024, 1024, 736, 736, 1311, 1311))) {
assertEquals(prefetchRectangle(0, 1, 0, 1), new HashSet<>(planned));
cache.prepareChunkColumns(800, 800);
cache.prepareChunkColumns(1300, 1300);
assertEquals(prefetchRectangle(0, 1, 0, 1), new HashSet<>(planned));
assertEquals(4, planned.size());
}
cache.close();
}
@Test
public void pregenScopesRestoreStudioPrefetchAndIgnoreSupersededClose() {
HydrologyPlanner planner = mock(HydrologyPlanner.class);
@@ -99,7 +99,7 @@ public class PregenPerformanceProfileTest {
}
@Test
public void pregenerationWantsTwoBurstWorkersPerCore() {
public void pregenerationWantsTwoBurstWorkersPerPerformanceCore() {
assertEquals(32, PregenPerformanceProfile.pregenBurstParallelism(16));
assertEquals(4, PregenPerformanceProfile.pregenBurstParallelism(1));
}