mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 10:12:53 +00:00
Performance Improvements
This commit is contained in:
parent
2f8fe43ea3
commit
dc851d856d
@ -167,24 +167,6 @@ public class IrisEngine extends BlockPopulator implements Engine {
|
|||||||
try {
|
try {
|
||||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||||
Hunk<BlockData> blocks = vblocks.listen((xx, y, zz, t) -> catchBlockUpdates(x + xx, y + getMinHeight(), z + zz, t));
|
Hunk<BlockData> blocks = vblocks.listen((xx, y, zz, t) -> catchBlockUpdates(x + xx, y + getMinHeight(), z + zz, t));
|
||||||
PrecisionStopwatch px = PrecisionStopwatch.start();
|
|
||||||
|
|
||||||
if (multicore) {
|
|
||||||
BurstExecutor b = burst().burst(16);
|
|
||||||
for (int i = 0; i < vblocks.getWidth(); i++) {
|
|
||||||
int finalI = i;
|
|
||||||
b.queue(() -> {
|
|
||||||
for (int j = 0; j < vblocks.getDepth(); j++) {
|
|
||||||
getFramework().getComplex().getTrueBiomeStream().get(x + finalI, z + j);
|
|
||||||
getFramework().getComplex().getTrueHeightStream().get(x + finalI, z + j);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
b.complete();
|
|
||||||
}
|
|
||||||
|
|
||||||
getMetrics().getPrecache().put(px.getMilliseconds());
|
|
||||||
|
|
||||||
switch (getDimension().getTerrainMode()) {
|
switch (getDimension().getTerrainMode()) {
|
||||||
case NORMAL -> {
|
case NORMAL -> {
|
||||||
|
@ -99,7 +99,7 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
|
|||||||
this.production = production;
|
this.production = production;
|
||||||
this.dimensionQuery = query;
|
this.dimensionQuery = query;
|
||||||
initialized = new AtomicBoolean(false);
|
initialized = new AtomicBoolean(false);
|
||||||
art = J.ar(this::tick, 100);
|
art = J.ar(this::tick, 20);
|
||||||
populators = new KList<BlockPopulator>().qadd(new BlockPopulator() {
|
populators = new KList<BlockPopulator>().qadd(new BlockPopulator() {
|
||||||
@Override
|
@Override
|
||||||
public void populate(@NotNull World world, @NotNull Random random, @NotNull Chunk chunk) {
|
public void populate(@NotNull World world, @NotNull Random random, @NotNull Chunk chunk) {
|
||||||
|
@ -28,7 +28,6 @@ public class EngineMetrics {
|
|||||||
private final AtomicRollingSequence updates;
|
private final AtomicRollingSequence updates;
|
||||||
private final AtomicRollingSequence terrain;
|
private final AtomicRollingSequence terrain;
|
||||||
private final AtomicRollingSequence biome;
|
private final AtomicRollingSequence biome;
|
||||||
private final AtomicRollingSequence precache;
|
|
||||||
private final AtomicRollingSequence parallax;
|
private final AtomicRollingSequence parallax;
|
||||||
private final AtomicRollingSequence parallaxInsert;
|
private final AtomicRollingSequence parallaxInsert;
|
||||||
private final AtomicRollingSequence post;
|
private final AtomicRollingSequence post;
|
||||||
@ -38,7 +37,6 @@ public class EngineMetrics {
|
|||||||
private final AtomicRollingSequence deposit;
|
private final AtomicRollingSequence deposit;
|
||||||
|
|
||||||
public EngineMetrics(int mem) {
|
public EngineMetrics(int mem) {
|
||||||
this.precache = new AtomicRollingSequence(mem);
|
|
||||||
this.total = new AtomicRollingSequence(mem);
|
this.total = new AtomicRollingSequence(mem);
|
||||||
this.terrain = new AtomicRollingSequence(mem);
|
this.terrain = new AtomicRollingSequence(mem);
|
||||||
this.biome = new AtomicRollingSequence(mem);
|
this.biome = new AtomicRollingSequence(mem);
|
||||||
@ -55,7 +53,6 @@ public class EngineMetrics {
|
|||||||
public KMap<String, Double> pull() {
|
public KMap<String, Double> pull() {
|
||||||
KMap<String, Double> v = new KMap<>();
|
KMap<String, Double> v = new KMap<>();
|
||||||
v.put("total", total.getAverage());
|
v.put("total", total.getAverage());
|
||||||
v.put("precache", precache.getAverage());
|
|
||||||
v.put("terrain", terrain.getAverage());
|
v.put("terrain", terrain.getAverage());
|
||||||
v.put("biome", biome.getAverage());
|
v.put("biome", biome.getAverage());
|
||||||
v.put("parallax", parallax.getAverage());
|
v.put("parallax", parallax.getAverage());
|
||||||
|
@ -42,15 +42,15 @@ public class PlannedStructure {
|
|||||||
private IrisJigsawStructure structure;
|
private IrisJigsawStructure structure;
|
||||||
private IrisPosition position;
|
private IrisPosition position;
|
||||||
private IrisDataManager data;
|
private IrisDataManager data;
|
||||||
|
private RNG rng;
|
||||||
|
private boolean verbose;
|
||||||
|
private boolean terminating;
|
||||||
private static transient ConcurrentLinkedHashMap<String, IrisObject> objectRotationCache
|
private static transient ConcurrentLinkedHashMap<String, IrisObject> objectRotationCache
|
||||||
= new ConcurrentLinkedHashMap.Builder<String, IrisObject>()
|
= new ConcurrentLinkedHashMap.Builder<String, IrisObject>()
|
||||||
.initialCapacity(64)
|
.initialCapacity(64)
|
||||||
.maximumWeightedCapacity(1024)
|
.maximumWeightedCapacity(1024)
|
||||||
.concurrencyLevel(32)
|
.concurrencyLevel(32)
|
||||||
.build();
|
.build();
|
||||||
private RNG rng;
|
|
||||||
private boolean verbose;
|
|
||||||
private boolean terminating;
|
|
||||||
|
|
||||||
public PlannedStructure(IrisJigsawStructure structure, IrisPosition position, RNG rng) {
|
public PlannedStructure(IrisJigsawStructure structure, IrisPosition position, RNG rng) {
|
||||||
terminating = false;
|
terminating = false;
|
||||||
@ -286,17 +286,9 @@ public class PlannedStructure {
|
|||||||
|
|
||||||
IrisPosition shift = test.getWorldPosition(testConnector);
|
IrisPosition shift = test.getWorldPosition(testConnector);
|
||||||
test.setPosition(desiredPosition.sub(shift));
|
test.setPosition(desiredPosition.sub(shift));
|
||||||
KList<PlannedPiece> collision = collidesWith(test);
|
|
||||||
|
|
||||||
if (pieceConnector.isInnerConnector() && collision.isNotEmpty()) {
|
if(collidesWith(test, piece))
|
||||||
for (PlannedPiece i : collision) {
|
{
|
||||||
if (i.equals(piece)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else if (collision.isNotEmpty()) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -359,17 +351,6 @@ public class PlannedStructure {
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
public KList<PlannedPiece> collidesWith(PlannedPiece piece) {
|
|
||||||
KList<PlannedPiece> v = new KList<>();
|
|
||||||
for (PlannedPiece i : pieces) {
|
|
||||||
if (i.collidesWith(piece)) {
|
|
||||||
v.add(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean collidesWith(PlannedPiece piece, PlannedPiece ignore) {
|
public boolean collidesWith(PlannedPiece piece, PlannedPiece ignore) {
|
||||||
for (PlannedPiece i : pieces) {
|
for (PlannedPiece i : pieces) {
|
||||||
if (i.equals(ignore)) {
|
if (i.equals(ignore)) {
|
||||||
|
@ -51,19 +51,11 @@ public class IrisPostModifier extends EngineAssignedModifier<BlockData> {
|
|||||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||||
int i;
|
int i;
|
||||||
AtomicInteger j = new AtomicInteger();
|
AtomicInteger j = new AtomicInteger();
|
||||||
if (false) { // TODO FIX DESYNCS
|
|
||||||
BurstExecutor e = getEngine().burst().burst(output.getWidth());
|
|
||||||
for (i = 0; i < output.getWidth(); i++) {
|
|
||||||
int finalI = i;
|
|
||||||
e.queue(() -> {
|
|
||||||
for (j.set(0); j.get() < output.getDepth(); j.getAndIncrement()) {
|
|
||||||
post(finalI, j.get(), output, finalI + x, j.get() + z);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
e.complete();
|
|
||||||
} else {
|
|
||||||
|
|
||||||
|
for (i = 0; i < output.getWidth(); i++) {
|
||||||
|
for (j.set(0); j.get() < output.getDepth(); j.getAndIncrement()) {
|
||||||
|
post(i, j.get(), output, i + x, j.get() + z);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getEngine().getMetrics().getPost().put(p.getMilliseconds());
|
getEngine().getMetrics().getPost().put(p.getMilliseconds());
|
||||||
@ -71,7 +63,6 @@ public class IrisPostModifier extends EngineAssignedModifier<BlockData> {
|
|||||||
|
|
||||||
@SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter")
|
@SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter")
|
||||||
private void post(int currentPostX, int currentPostZ, Hunk<BlockData> currentData, int x, int z) {
|
private void post(int currentPostX, int currentPostZ, Hunk<BlockData> currentData, int x, int z) {
|
||||||
|
|
||||||
int h = getFramework().getEngineParallax().trueHeight(x, z);
|
int h = getFramework().getEngineParallax().trueHeight(x, z);
|
||||||
int ha = getFramework().getEngineParallax().trueHeight(x + 1, z);
|
int ha = getFramework().getEngineParallax().trueHeight(x + 1, z);
|
||||||
int hb = getFramework().getEngineParallax().trueHeight(x, z + 1);
|
int hb = getFramework().getEngineParallax().trueHeight(x, z + 1);
|
||||||
|
@ -71,10 +71,10 @@ public class IrisObject extends IrisRegistrant {
|
|||||||
private transient BlockVector center;
|
private transient BlockVector center;
|
||||||
private transient volatile boolean smartBored = false;
|
private transient volatile boolean smartBored = false;
|
||||||
private transient IrisLock lock = new IrisLock("Preloadcache");
|
private transient IrisLock lock = new IrisLock("Preloadcache");
|
||||||
private transient AtomicCache<AxisAlignedBB> aabb;
|
private transient AtomicCache<AxisAlignedBB> aabb = new AtomicCache<>();
|
||||||
|
|
||||||
public AxisAlignedBB getAABB() {
|
public AxisAlignedBB getAABB() {
|
||||||
return getAABBFor(new BlockVector(w, h, d));
|
return aabb.aquire(() -> getAABBFor(new BlockVector(w, h, d)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlockVector getCenterForSize(BlockVector size) {
|
public static BlockVector getCenterForSize(BlockVector size) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user