Even more work

This commit is contained in:
Nassim Jahnke 2024-12-03 21:03:25 +01:00
parent 4601dc901b
commit 2331dad0a0
No known key found for this signature in database
GPG key ID: EF6771C01F6EF02F
3 changed files with 24 additions and 15 deletions

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Separate dimensiondata executor
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
index 276ad77ecb274b6cd454d0f92457964a8eaa5824..1360aa8202542d3d0f32247f1123575fc2c38ff1 100644
index 1a31024b46a5d7960f1e0f172f8ebcf396dd3139..38ffa1c4c204f73746c4b87127de92b631548eb1 100644
--- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java
@@ -94,6 +94,7 @@ public class Util {
@ -16,7 +16,7 @@ index 276ad77ecb274b6cd454d0f92457964a8eaa5824..1360aa8202542d3d0f32247f1123575f
private static final TracingExecutor DOWNLOAD_POOL = makeIoExecutor("Download-", true);
// Paper start - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread
public static final ExecutorService PROFILE_EXECUTOR = Executors.newFixedThreadPool(2, new java.util.concurrent.ThreadFactory() {
@@ -260,6 +261,21 @@ public class Util {
@@ -265,6 +266,21 @@ public class Util {
}));
}
@ -39,15 +39,24 @@ index 276ad77ecb274b6cd454d0f92457964a8eaa5824..1360aa8202542d3d0f32247f1123575f
throw t instanceof RuntimeException ? (RuntimeException)t : new RuntimeException(t);
}
diff --git a/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java b/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java
index d16f124e0371ce943298c8d7d9bfac21e98cf885..8212f2dfba5c2eee5a823b5217fb43dc870d228a 100644
index 3c3b18e5b419a0f785467c511dcdd65873ad0989..9272c91e0ee489091fdf1fedcf3801c070e9e82a 100644
--- a/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java
+++ b/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java
@@ -155,7 +155,7 @@ public class DimensionDataStorage implements AutoCloseable {
} catch (IOException var3) {
LOGGER.error("Could not save data to {}", path.getFileName(), var3);
}
- }, Util.ioPool());
+ }, Util.DIMENSION_DATA_IO_POOL); // Paper - Separate dimension data IO pool
}
public void saveAndJoin() {
@@ -139,7 +139,7 @@ public class DimensionDataStorage implements AutoCloseable {
} else {
int i = Util.maxAllowedExecutorThreads();
int j = map.size();
- if (j > i) {
+ if (false && j > i) { // Paper - Separate dimension data IO pool; just throw them into the fixed pool queue
this.pendingWriteFuture = this.pendingWriteFuture.thenCompose(object -> {
List<CompletableFuture<?>> list = new ArrayList<>(i);
int k = Mth.positiveCeilDiv(j, i);
@@ -160,7 +160,7 @@ public class DimensionDataStorage implements AutoCloseable {
v -> CompletableFuture.allOf(
map.entrySet()
.stream()
- .map(entry -> CompletableFuture.runAsync(() -> tryWrite(entry.getKey(), entry.getValue()), Util.ioPool()))
+ .map(entry -> CompletableFuture.runAsync(() -> tryWrite(entry.getKey(), entry.getValue()), Util.DIMENSION_DATA_IO_POOL)) // Paper - Separate dimension data IO pool
.toArray(CompletableFuture[]::new)
)
);

View file

@ -9,10 +9,10 @@ flow for them, this is not all too surprising. So, we shall resort to always
sending the patterns over the network for update packets.
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java
index 98bc87fe5d153cc4927f7e1b4a02f61d9dd019a0..9528935a120f7d5a1fdb1a796854478e8a83f833 100644
index 27fd8b88dc1433c1df1e09604a3cc546bfa0d2b9..1f3e1c7128b9a0f27f2df39a8970050c5313d7a3 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java
@@ -63,7 +63,7 @@ public class BannerBlockEntity extends BlockEntity implements Nameable {
@@ -57,7 +57,7 @@ public class BannerBlockEntity extends BlockEntity implements Nameable {
@Override
protected void saveAdditional(CompoundTag nbt, HolderLookup.Provider registries) {
super.saveAdditional(nbt, registries);
@ -21,7 +21,7 @@ index 98bc87fe5d153cc4927f7e1b4a02f61d9dd019a0..9528935a120f7d5a1fdb1a796854478e
nbt.put("patterns", (Tag) BannerPatternLayers.CODEC.encodeStart(registries.createSerializationContext(NbtOps.INSTANCE), this.patterns).getOrThrow());
}
@@ -95,9 +95,18 @@ public class BannerBlockEntity extends BlockEntity implements Nameable {
@@ -89,9 +89,18 @@ public class BannerBlockEntity extends BlockEntity implements Nameable {
return ClientboundBlockEntityDataPacket.create(this);
}