aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0047-Configurable-Chunk-IO-Thread-Base-Count.patch
blob: 1e38d981f13b25576726cd15e36a46ca45ebb0e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
From 4d33547c24567a2bedc35176c38b04c8f7320f38 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Wed, 2 Mar 2016 23:46:57 -0600
Subject: [PATCH] Configurable Chunk IO Thread Base Count


diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 1ea799d59..8c8bc4c86 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -198,4 +198,9 @@ public class PaperConfig {
                 " - Interval: " + timeSummary(Timings.getHistoryInterval() / 20) +
                 " - Length: " + timeSummary(Timings.getHistoryLength() / 20));
     }
+
+    public static int minChunkLoadThreads = 2;
+    private static void chunkLoadThreads() {
+        minChunkLoadThreads = Math.min(6, getInt("settings.min-chunk-load-threads", 2)); // Keep people from doing stupid things with max of 6
+    }
 }
diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java
index e4fd9bc60..7b7a3d01b 100644
--- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java
+++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java
@@ -1,5 +1,6 @@
 package org.bukkit.craftbukkit.chunkio;
 
+import com.destroystokyo.paper.PaperConfig;
 import net.minecraft.server.Chunk;
 import net.minecraft.server.ChunkProviderServer;
 import net.minecraft.server.ChunkRegionLoader;
@@ -7,7 +8,7 @@ import net.minecraft.server.World;
 import org.bukkit.craftbukkit.util.AsynchronousExecutor;
 
 public class ChunkIOExecutor {
-    static final int BASE_THREADS = 1;
+    static final int BASE_THREADS = PaperConfig.minChunkLoadThreads; // Paper
     static final int PLAYERS_PER_THREAD = 50;
 
     private static final AsynchronousExecutor<QueuedChunk, Chunk, Runnable, RuntimeException> instance = new AsynchronousExecutor<QueuedChunk, Chunk, Runnable, RuntimeException>(new ChunkIOProvider(), BASE_THREADS);
-- 
2.12.0.windows.1