mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Allow disabling some locks in settings for speedups
This commit is contained in:
parent
1923ae6f4b
commit
1edf567ea7
@ -88,6 +88,7 @@ public class IrisSettings {
|
|||||||
public int pregenThreadPriority = 8;
|
public int pregenThreadPriority = 8;
|
||||||
public int miscThreadCount = -4;
|
public int miscThreadCount = -4;
|
||||||
public int miscThreadPriority = 3;
|
public int miscThreadPriority = 3;
|
||||||
|
public boolean unstableLockingHeuristics = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
package com.volmit.iris.engine.parallax;
|
package com.volmit.iris.engine.parallax;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.engine.hunk.Hunk;
|
import com.volmit.iris.engine.hunk.Hunk;
|
||||||
import com.volmit.iris.engine.hunk.io.HunkIOAdapter;
|
import com.volmit.iris.engine.hunk.io.HunkIOAdapter;
|
||||||
import com.volmit.iris.engine.hunk.io.HunkRegion;
|
import com.volmit.iris.engine.hunk.io.HunkRegion;
|
||||||
@ -26,6 +27,7 @@ import com.volmit.iris.engine.hunk.io.HunkRegionSlice;
|
|||||||
import com.volmit.iris.engine.object.tile.TileData;
|
import com.volmit.iris.engine.object.tile.TileData;
|
||||||
import com.volmit.iris.engine.parallel.GridLock;
|
import com.volmit.iris.engine.parallel.GridLock;
|
||||||
import com.volmit.iris.engine.parallel.MultiBurst;
|
import com.volmit.iris.engine.parallel.MultiBurst;
|
||||||
|
import com.volmit.iris.engine.parallel.NOOPGridLock;
|
||||||
import com.volmit.iris.util.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
import com.volmit.iris.util.math.M;
|
import com.volmit.iris.util.math.M;
|
||||||
import com.volmit.iris.util.oldnbt.ByteArrayTag;
|
import com.volmit.iris.util.oldnbt.ByteArrayTag;
|
||||||
@ -56,7 +58,7 @@ public class ParallaxRegion extends HunkRegion {
|
|||||||
this.burst = burst;
|
this.burst = burst;
|
||||||
this.height = height;
|
this.height = height;
|
||||||
setupSlices();
|
setupSlices();
|
||||||
lock = new GridLock(32, 32);
|
lock = newGridLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ParallaxRegion(MultiBurst burst, int height, File folder, int x, int z) {
|
public ParallaxRegion(MultiBurst burst, int height, File folder, int x, int z) {
|
||||||
@ -64,7 +66,11 @@ public class ParallaxRegion extends HunkRegion {
|
|||||||
this.burst = burst;
|
this.burst = burst;
|
||||||
this.height = height;
|
this.height = height;
|
||||||
setupSlices();
|
setupSlices();
|
||||||
lock = new GridLock(32, 32);
|
lock = newGridLock();
|
||||||
|
}
|
||||||
|
|
||||||
|
private GridLock newGridLock() {
|
||||||
|
return IrisSettings.get().getConcurrency().isUnstableLockingHeuristics() ? new NOOPGridLock(1, 1) : new GridLock(32, 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupSlices() {
|
private void setupSlices() {
|
||||||
|
@ -0,0 +1,81 @@
|
|||||||
|
/*
|
||||||
|
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||||
|
* Copyright (c) 2021 Arcane Arts (Volmit Software)
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.volmit.iris.engine.parallel;
|
||||||
|
|
||||||
|
import com.volmit.iris.util.function.NastyRunnable;
|
||||||
|
import com.volmit.iris.util.io.IORunnable;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
public class NOOPGridLock extends GridLock{
|
||||||
|
public NOOPGridLock(int x, int z) {
|
||||||
|
super(x, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void with(int x, int z, Runnable r) {
|
||||||
|
r.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void withNasty(int x, int z, NastyRunnable r) throws Throwable {
|
||||||
|
r.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void withIO(int x, int z, IORunnable r) throws IOException {
|
||||||
|
r.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T> T withResult(int x, int z, Supplier<T> r) {
|
||||||
|
return r.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void withAll(Runnable r) {
|
||||||
|
r.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T> T withAllResult(Supplier<T> r) {
|
||||||
|
return r.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean tryLock(int x, int z) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean tryLock(int x, int z, long timeout) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void lock(int x, int z) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void unlock(int x, int z) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user