9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-19 15:09:18 +00:00

minor speed improvements

This commit is contained in:
Julian Krings
2025-11-01 22:36:25 +01:00
parent ea5919def2
commit 4ca7ea3911
3 changed files with 13 additions and 7 deletions

View File

@@ -58,8 +58,9 @@ registerCustomOutputTaskUnix("PixelMac", "/Users/test/Desktop/mcserver/plugins")
registerCustomOutputTaskUnix("CrazyDev22LT", "/home/julian/Desktop/server/plugins") registerCustomOutputTaskUnix("CrazyDev22LT", "/home/julian/Desktop/server/plugins")
// ============================================================== // ==============================================================
val serverMinHeap = "2G" val serverMinHeap = "10G"
val serverMaxHeap = "8G" val serverMaxHeap = "10G"
val additionalFlags = "-XX:+AlwaysPreTouch"
//Valid values are: none, truecolor, indexed256, indexed16, indexed8 //Valid values are: none, truecolor, indexed256, indexed16, indexed8
val color = "truecolor" val color = "truecolor"
val errorReporting = findProperty("errorReporting") as Boolean? ?: false val errorReporting = findProperty("errorReporting") as Boolean? ?: false
@@ -106,6 +107,7 @@ nmsBindings.forEach { key, value ->
systemProperty("com.mojang.eula.agree", true) systemProperty("com.mojang.eula.agree", true)
systemProperty("iris.suppressReporting", !errorReporting) systemProperty("iris.suppressReporting", !errorReporting)
jvmArgs("-javaagent:${project(":core:agent").tasks.jar.flatMap { it.archiveFile }.get().asFile.absolutePath}") jvmArgs("-javaagent:${project(":core:agent").tasks.jar.flatMap { it.archiveFile }.get().asFile.absolutePath}")
jvmArgs(additionalFlags.split(' '))
} }
} }

View File

@@ -183,8 +183,13 @@ public class MantleWriter implements IObjectPlacer, AutoCloseable {
Iris.error("Mantle Writer Accessed chunk out of bounds" + cx + "," + cz); Iris.error("Mantle Writer Accessed chunk out of bounds" + cx + "," + cz);
return null; return null;
} }
MantleChunk chunk = cachedChunks.computeIfAbsent(Cache.key(cx, cz), k -> mantle.getChunk(cx, cz).use()); final Long key = Cache.key(cx, cz);
if (chunk == null) Iris.error("Mantle Writer Accessed " + cx + "," + cz + " and came up null (and yet within bounds!)"); MantleChunk chunk = cachedChunks.get(key);
if (chunk == null) {
chunk = mantle.getChunk(cx, cz).use();
var old = cachedChunks.put(key, chunk);
if (old != null) old.release();
}
return chunk; return chunk;
} }

View File

@@ -7,13 +7,12 @@ import com.volmit.iris.util.context.ChunkContext
import com.volmit.iris.util.documentation.ChunkCoordinates import com.volmit.iris.util.documentation.ChunkCoordinates
import com.volmit.iris.util.mantle.Mantle import com.volmit.iris.util.mantle.Mantle
import com.volmit.iris.util.mantle.flag.MantleFlag import com.volmit.iris.util.mantle.flag.MantleFlag
import com.volmit.iris.util.parallel.MultiBurst
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.asCoroutineDispatcher
import kotlinx.coroutines.flow.FlowCollector import kotlinx.coroutines.flow.FlowCollector
import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import java.util.concurrent.Executors
import kotlin.coroutines.EmptyCoroutineContext import kotlin.coroutines.EmptyCoroutineContext
interface MatterGenerator { interface MatterGenerator {
@@ -61,7 +60,7 @@ interface MatterGenerator {
} }
companion object { companion object {
private val dispatcher = Executors.newVirtualThreadPerTaskExecutor().asCoroutineDispatcher() private val dispatcher = MultiBurst.burst.dispatcher
private fun CoroutineScope.launch(block: suspend CoroutineScope.() -> Unit) = private fun CoroutineScope.launch(block: suspend CoroutineScope.() -> Unit) =
launch(if (IrisSettings.get().generator.isUseMulticoreMantle) dispatcher else EmptyCoroutineContext, block = block) launch(if (IrisSettings.get().generator.isUseMulticoreMantle) dispatcher else EmptyCoroutineContext, block = block)
} }