2019-04-23 06:47:07 +02:00
|
|
|
From a05120f07988e9b44ec31b64d116eecdf159d664 Mon Sep 17 00:00:00 2001
|
2018-07-15 03:53:17 +02:00
|
|
|
From: Antony Riley <antony@cyberiantiger.org>
|
|
|
|
Date: Tue, 29 Mar 2016 06:56:23 +0300
|
|
|
|
Subject: [PATCH] Reduce IO ops opening a new region file.
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java
|
2019-02-22 04:41:20 +01:00
|
|
|
index 9626396745..e2d4450e90 100644
|
2018-07-15 03:53:17 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/RegionFile.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/RegionFile.java
|
2019-02-22 04:41:20 +01:00
|
|
|
@@ -71,9 +71,17 @@ public class RegionFile {
|
2018-09-01 00:56:57 +02:00
|
|
|
this.c.seek(0L);
|
2018-07-15 03:53:17 +02:00
|
|
|
|
2019-02-22 04:41:20 +01:00
|
|
|
int k;
|
2018-07-15 03:53:17 +02:00
|
|
|
+ // Paper Start
|
2019-02-22 04:41:20 +01:00
|
|
|
+ java.nio.ByteBuffer header = java.nio.ByteBuffer.allocate(8192);
|
2018-07-15 03:53:17 +02:00
|
|
|
+ while (header.hasRemaining()) {
|
2019-02-22 04:41:20 +01:00
|
|
|
+ if (this.c.getChannel().read(header) == -1) throw new java.io.EOFException();
|
2018-07-15 03:53:17 +02:00
|
|
|
+ }
|
|
|
|
+ header.clear();
|
2019-02-22 04:41:20 +01:00
|
|
|
+ java.nio.IntBuffer headerAsInts = header.asIntBuffer();
|
2018-07-15 03:53:17 +02:00
|
|
|
+ // Paper End
|
2019-01-01 04:15:55 +01:00
|
|
|
|
2019-02-22 04:41:20 +01:00
|
|
|
for (j = 0; j < 1024; ++j) {
|
2019-01-01 04:15:55 +01:00
|
|
|
- k = this.c.readInt();
|
2019-02-22 04:41:20 +01:00
|
|
|
+ k = headerAsInts.get(); // Paper
|
|
|
|
this.d[j] = k;
|
|
|
|
// Spigot start
|
|
|
|
int length = k & 255;
|
|
|
|
@@ -99,7 +107,7 @@ public class RegionFile {
|
2018-07-15 03:53:17 +02:00
|
|
|
}
|
|
|
|
|
2019-01-01 04:15:55 +01:00
|
|
|
for (j = 0; j < 1024; ++j) {
|
|
|
|
- k = this.c.readInt();
|
2019-02-22 04:41:20 +01:00
|
|
|
+ k = headerAsInts.get(); // Paper
|
2019-01-01 04:15:55 +01:00
|
|
|
this.e[j] = k;
|
2018-07-15 03:53:17 +02:00
|
|
|
}
|
|
|
|
} catch (IOException ioexception) {
|
|
|
|
--
|
2019-04-23 06:47:07 +02:00
|
|
|
2.21.0
|
2018-07-15 03:53:17 +02:00
|
|
|
|