20-30% performance increase

This commit is contained in:
repixelatedmc 2024-08-20 19:22:36 +02:00
parent 055ddc7c9b
commit 0fa9654824

View File

@ -38,12 +38,14 @@ public class HeadlessPregenMethod implements PregeneratorMethod {
private final Semaphore semaphore; private final Semaphore semaphore;
private final int max; private final int max;
private final World world; private final World world;
private final MultiBurst burst;
public HeadlessPregenMethod(Engine engine) { public HeadlessPregenMethod(Engine engine) {
this.world = engine.getWorld().realWorld(); this.world = engine.getWorld().realWorld();
this.max = IrisSettings.getThreadCount(IrisSettings.get().getConcurrency().getParallelism()); this.max = IrisSettings.getThreadCount(IrisSettings.get().getConcurrency().getParallelism());
this.engine = engine; this.engine = engine;
this.headless = INMS.get().createHeadless(engine); this.headless = INMS.get().createHeadless(engine);
burst = new MultiBurst("HeadlessPregen", 8 );
this.semaphore = new Semaphore(max); this.semaphore = new Semaphore(max);
} }
@ -91,7 +93,7 @@ public class HeadlessPregenMethod implements PregeneratorMethod {
semaphore.release(); semaphore.release();
return; return;
} }
MultiBurst.burst.complete(() -> { burst.complete(() -> {
try { try {
listener.onChunkGenerating(x, z); listener.onChunkGenerating(x, z);
headless.generateChunk(x, z); headless.generateChunk(x, z);