3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00
Paper/CraftBukkit-Patches/0148-More-effecient-RegionFile-zero-ing.patch

37 Zeilen
1.4 KiB
Diff

2016-03-01 01:23:45 +01:00
From 630c07926fec1744af435452e552445389be028f Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 29 Aug 2015 17:48:20 -0400
Subject: [PATCH] More effecient RegionFile zero'ing
Speeds up new Chunk Generation by using 2 4k block writes vs 2048 4 byte writes
more effecient than going in and out of native calls repeatedly.
diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java
2016-02-29 22:33:06 +01:00
index 1cd8be8..4c39b54 100644
--- a/src/main/java/net/minecraft/server/RegionFile.java
+++ b/src/main/java/net/minecraft/server/RegionFile.java
2016-02-29 22:33:06 +01:00
@@ -17,7 +17,7 @@ import java.util.zip.InflaterInputStream;
public class RegionFile {
- private static final byte[] a = new byte[4096];
+ private static final byte[] a = new byte[4096]; // Spigot - note: if this ever changes to not be 4096 bytes, update constructor! // PAIL: empty 4k block
private final File b;
private RandomAccessFile c;
private final int[] d = new int[1024];
2016-02-29 22:33:06 +01:00
@@ -37,8 +37,9 @@ public class RegionFile {
2016-02-29 22:33:06 +01:00
this.c = new RandomAccessFile(file, "rw");
if (this.c.length() < 4096L) {
2016-02-29 22:33:06 +01:00
- this.c.write(RegionFile.a);
- this.c.write(RegionFile.a);
+ // Spigot - more effecient chunk zero'ing
+ this.c.write(RegionFile.a); // Spigot
+ this.c.write(RegionFile.a); // Spigot
this.g += 8192;
}
2016-02-29 22:33:06 +01:00
--
2016-02-29 22:33:06 +01:00
2.5.0