mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-04-06 07:46:08 +00:00
Thread counts synced
This commit is contained in:
@@ -107,7 +107,7 @@ public class IrisComplex implements DataProvider {
|
||||
}
|
||||
|
||||
public IrisComplex(Engine engine, boolean simple) {
|
||||
int cacheSize = 1024 * 128;
|
||||
int cacheSize = 131072;
|
||||
IrisBiome emptyBiome = new IrisBiome();
|
||||
this.rng = new RNG(engine.getWorld().seed());
|
||||
this.data = engine.getData();
|
||||
|
||||
@@ -25,10 +25,7 @@ import com.volmit.iris.engine.object.IrisBiome;
|
||||
import com.volmit.iris.engine.object.IrisBiomePaletteLayer;
|
||||
import com.volmit.iris.engine.object.IrisDecorator;
|
||||
import com.volmit.iris.engine.object.IrisObjectPlacement;
|
||||
import com.volmit.iris.engine.parallel.MultiBurst;
|
||||
import com.volmit.iris.util.documentation.ChunkCoordinates;
|
||||
import com.volmit.iris.util.format.C;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
import com.volmit.iris.util.scheduling.J;
|
||||
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
||||
@@ -42,8 +39,6 @@ import org.bukkit.generator.BlockPopulator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
public class IrisEngine extends BlockPopulator implements Engine {
|
||||
@Getter
|
||||
|
||||
@@ -302,7 +302,7 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
|
||||
initialized.set(true);
|
||||
IrisDimension dim = getDimension(world);
|
||||
IrisDataManager data = production ? new IrisDataManager(getDataFolder(world)) : dim.getLoader().copy();
|
||||
compound.set(new IrisEngineCompound(world, dim, data, Iris.getThreadCount()));
|
||||
compound.set(new IrisEngineCompound(world, dim, data, IrisSettings.getThreadCount(IrisSettings.get().getConcurrency().getThreadCount())));
|
||||
compound.get().setStudio(!production);
|
||||
populators.clear();
|
||||
populators.addAll(compound.get().getPopulators());
|
||||
|
||||
@@ -272,7 +272,7 @@ public interface EngineParallaxManager extends DataProvider, IObjectPlacer {
|
||||
int i, j;
|
||||
KList<Runnable> after = new KList<>();
|
||||
int bs = (int) Math.pow((s * 2) + 1, 2);
|
||||
BurstExecutor burst = MultiBurst.burst.burst(bs);
|
||||
BurstExecutor burst = getEngine().getTarget().getBurster().burst(bs);
|
||||
for (i = -s; i <= s; i++) {
|
||||
for (j = -s; j <= s; j++) {
|
||||
int xx = i + x;
|
||||
@@ -294,7 +294,7 @@ public interface EngineParallaxManager extends DataProvider, IObjectPlacer {
|
||||
burst.complete();
|
||||
|
||||
if (getEngine().getDimension().isPlaceObjects()) {
|
||||
burst = MultiBurst.burst.burst(bs);
|
||||
burst = getEngine().getTarget().getBurster().burst(bs);
|
||||
|
||||
for (i = -s; i <= s; i++) {
|
||||
int ii = i;
|
||||
@@ -310,7 +310,7 @@ public interface EngineParallaxManager extends DataProvider, IObjectPlacer {
|
||||
}
|
||||
|
||||
burst.complete();
|
||||
burst = MultiBurst.burst.burst(bs);
|
||||
burst = getEngine().getTarget().getBurster().burst(bs);
|
||||
|
||||
for (i = -s; i <= s; i++) {
|
||||
int ii = i;
|
||||
@@ -323,7 +323,7 @@ public interface EngineParallaxManager extends DataProvider, IObjectPlacer {
|
||||
burst.complete();
|
||||
}
|
||||
|
||||
MultiBurst.burst.burst(after);
|
||||
getEngine().getTarget().getBurster().burst(after);
|
||||
getParallaxAccess().setChunkGenerated(x, z);
|
||||
p.end();
|
||||
getEngine().getMetrics().getParallax().put(p.getMilliseconds());
|
||||
@@ -677,7 +677,7 @@ public interface EngineParallaxManager extends DataProvider, IObjectPlacer {
|
||||
}
|
||||
|
||||
Iris.verbose("Checking sizes for " + Form.f(objects.size()) + " referenced objects.");
|
||||
BurstExecutor e = MultiBurst.burst.burst(objects.size());
|
||||
BurstExecutor e = getEngine().getTarget().getBurster().burst(objects.size());
|
||||
KMap<String, BlockVector> sizeCache = new KMap<>();
|
||||
for (String i : objects) {
|
||||
e.queue(() -> {
|
||||
|
||||
@@ -42,9 +42,9 @@ public class EngineTarget {
|
||||
this.height = height;
|
||||
this.dimension = dimension;
|
||||
this.data = data;
|
||||
this.parallaxWorld = new ParallaxWorld(256, new File(world.worldFolder(), "iris/" + dimension.getLoadKey() + "/parallax"));
|
||||
this.inverted = inverted;
|
||||
this.burster = new MultiBurst(threads);
|
||||
this.burster = new MultiBurst("Iris Engine " + dimension.getName(), threads, 6);
|
||||
this.parallaxWorld = new ParallaxWorld(burster, 256, new File(world.worldFolder(), "iris/" + dimension.getLoadKey() + "/parallax"));
|
||||
}
|
||||
|
||||
public EngineTarget(IrisWorld world, IrisDimension dimension, IrisDataManager data, int height, int threads) {
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package com.volmit.iris.engine.headless;
|
||||
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.core.pregenerator.PregenListener;
|
||||
import com.volmit.iris.engine.data.mca.LoadFlags;
|
||||
import com.volmit.iris.engine.data.mca.MCAFile;
|
||||
@@ -43,7 +44,7 @@ public class HeadlessGenerator {
|
||||
public HeadlessGenerator(HeadlessWorld world)
|
||||
{
|
||||
this.world = world;
|
||||
burst = new MultiBurst("Iris Headless Generator", 9, Runtime.getRuntime().availableProcessors());
|
||||
burst = new MultiBurst("Iris Headless Generator", 9, IrisSettings.getThreadCount(IrisSettings.get().getConcurrency().getPregenThreadCount()));
|
||||
writer = new NBTWorld(world.getWorld().worldFolder());
|
||||
generator = new EngineCompositeGenerator(world.getDimension().getLoadKey(), !world.isStudio());
|
||||
generator.assignHeadlessGenerator(this);
|
||||
|
||||
@@ -98,8 +98,8 @@ public class HunkRegionSlice<T> {
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void save() {
|
||||
BurstExecutor e = MultiBurst.burst.burst();
|
||||
public synchronized void save(MultiBurst burst) {
|
||||
BurstExecutor e = burst.burst();
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.bergerkiller.bukkit.common.utils.MathUtil;
|
||||
import com.bergerkiller.bukkit.common.utils.WorldUtil;
|
||||
import com.bergerkiller.bukkit.common.wrappers.LongHashSet;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
|
||||
@@ -261,7 +262,7 @@ public class LightingTaskBatch implements LightingTask {
|
||||
LightingChunk nextChunk = null;
|
||||
CompletableFuture<Void> nextChunkFuture = null;
|
||||
synchronized (chunks_lock) {
|
||||
for (; i < chunks.length && numBeingLoaded < Iris.getThreadCount(); i++) {
|
||||
for (; i < chunks.length && numBeingLoaded < IrisSettings.getThreadCount(IrisSettings.get().getConcurrency().getThreadCount()); i++) {
|
||||
LightingChunk lc = chunks[i];
|
||||
if (lc.loadingStarted) {
|
||||
continue; // Already (being) loaded
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.volmit.iris.engine.hunk.io.HunkRegion;
|
||||
import com.volmit.iris.engine.hunk.io.HunkRegionSlice;
|
||||
import com.volmit.iris.engine.object.tile.TileData;
|
||||
import com.volmit.iris.engine.parallel.GridLock;
|
||||
import com.volmit.iris.engine.parallel.MultiBurst;
|
||||
import com.volmit.iris.util.format.C;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
import com.volmit.iris.util.math.M;
|
||||
@@ -50,16 +51,19 @@ public class ParallaxRegion extends HunkRegion {
|
||||
private final GridLock lock;
|
||||
private long lastUse;
|
||||
private final int height;
|
||||
private final MultiBurst burst;
|
||||
|
||||
public ParallaxRegion(int height, File folder, int x, int z, CompoundTag compound) {
|
||||
public ParallaxRegion(MultiBurst burst, int height, File folder, int x, int z, CompoundTag compound) {
|
||||
super(folder, x, z, compound);
|
||||
this.burst = burst;
|
||||
this.height = height;
|
||||
setupSlices();
|
||||
lock = new GridLock(32, 32);
|
||||
}
|
||||
|
||||
public ParallaxRegion(int height, File folder, int x, int z) {
|
||||
public ParallaxRegion(MultiBurst burst, int height, File folder, int x, int z) {
|
||||
super(folder, x, z);
|
||||
this.burst = burst;
|
||||
this.height = height;
|
||||
setupSlices();
|
||||
lock = new GridLock(32, 32);
|
||||
@@ -155,12 +159,13 @@ public class ParallaxRegion extends HunkRegion {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void save() throws IOException {
|
||||
blockSlice.save();
|
||||
objectSlice.save();
|
||||
entitySlice.save();
|
||||
tileSlice.save();
|
||||
updateSlice.save();
|
||||
blockSlice.save(burst);
|
||||
objectSlice.save(burst);
|
||||
entitySlice.save(burst);
|
||||
tileSlice.save(burst);
|
||||
updateSlice.save(burst);
|
||||
saveMetaHunk();
|
||||
Iris.debug("Saved Parallax Region "+ C.GOLD + getX() + " " + getZ());
|
||||
super.save();
|
||||
|
||||
@@ -40,10 +40,12 @@ public class ParallaxWorld implements ParallaxAccess {
|
||||
private final KMap<Long, ParallaxRegion> loadedRegions;
|
||||
private final KList<Long> save;
|
||||
private final File folder;
|
||||
private final MultiBurst burst;
|
||||
private final int height;
|
||||
|
||||
public ParallaxWorld(int height, File folder) {
|
||||
public ParallaxWorld(MultiBurst burst, int height, File folder) {
|
||||
this.height = height;
|
||||
this.burst = burst;
|
||||
this.folder = folder;
|
||||
save = new KList<>();
|
||||
loadedRegions = new KMap<>();
|
||||
@@ -125,7 +127,7 @@ public class ParallaxWorld implements ParallaxAccess {
|
||||
return loadedRegions.get(key(x, z));
|
||||
}
|
||||
|
||||
ParallaxRegion v = new ParallaxRegion(height, folder, x, z);
|
||||
ParallaxRegion v = new ParallaxRegion(burst, height, folder, x, z);
|
||||
loadedRegions.put(key(x, z), v);
|
||||
|
||||
return v;
|
||||
|
||||
Reference in New Issue
Block a user