3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00
Paper/Spigot-Server-Patches/0483-Reduce-MutableInt-allocations-from-light-engine.patch
Mariell Hoversholm 654b792caf Updated Upstream (CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
a339310c #755: Fix NPE when calling getInventory() for virtual EnderChests
2577f9bf Increase outdated build delay
1dabfdc8 #754: Fix pre-1.16 serialized SkullMeta being broken on 1.16+, losing textures
2020-09-27 11:04:51 -04:00

51 Zeilen
2.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <spottedleaf@spottedleaf.dev>
Date: Mon, 27 Apr 2020 02:48:06 -0700
Subject: [PATCH] Reduce MutableInt allocations from light engine
We can abuse the fact light is single threaded and share an instance
per light engine instance
diff --git a/src/main/java/net/minecraft/server/LightEngineBlock.java b/src/main/java/net/minecraft/server/LightEngineBlock.java
index 29e12f76a3e424d36506144e09e083cc5ce3bedc..4db28b9a9b8a1e91911126172c6670c252dd49cb 100644
--- a/src/main/java/net/minecraft/server/LightEngineBlock.java
+++ b/src/main/java/net/minecraft/server/LightEngineBlock.java
@@ -6,6 +6,7 @@ public final class LightEngineBlock extends LightEngineLayer<LightEngineStorageB
private static final EnumDirection[] e = EnumDirection.values();
private final BlockPosition.MutableBlockPosition f = new BlockPosition.MutableBlockPosition();
+ private final MutableInt mutableint = new MutableInt(); // Paper
public LightEngineBlock(ILightAccess ilightaccess) {
super(ilightaccess, EnumSkyBlock.BLOCK, new LightEngineStorageBlock(ilightaccess));
@@ -37,7 +38,7 @@ public final class LightEngineBlock extends LightEngineLayer<LightEngineStorageB
if (enumdirection == null) {
return 15;
} else {
- MutableInt mutableint = new MutableInt();
+ //MutableInt mutableint = new MutableInt(); // Paper - share mutableint, single threaded
IBlockData iblockdata = this.a(j, mutableint);
if (mutableint.getValue() >= 15) {
diff --git a/src/main/java/net/minecraft/server/LightEngineSky.java b/src/main/java/net/minecraft/server/LightEngineSky.java
index 2301a982e17ab9568e3da9ca84c4a024c7c1b214..f0b57784006752e031800a12a1a3c1a5945c636b 100644
--- a/src/main/java/net/minecraft/server/LightEngineSky.java
+++ b/src/main/java/net/minecraft/server/LightEngineSky.java
@@ -6,6 +6,7 @@ public final class LightEngineSky extends LightEngineLayer<LightEngineStorageSky
private static final EnumDirection[] e = EnumDirection.values();
private static final EnumDirection[] f = new EnumDirection[]{EnumDirection.NORTH, EnumDirection.SOUTH, EnumDirection.WEST, EnumDirection.EAST};
+ private final MutableInt mutableint = new MutableInt(); // Paper
public LightEngineSky(ILightAccess ilightaccess) {
super(ilightaccess, EnumSkyBlock.SKY, new LightEngineStorageSky(ilightaccess));
@@ -27,7 +28,7 @@ public final class LightEngineSky extends LightEngineLayer<LightEngineStorageSky
if (k >= 15) {
return k;
} else {
- MutableInt mutableint = new MutableInt();
+ //MutableInt mutableint = new MutableInt(); // Paper - share mutableint, single threaded
IBlockData iblockdata = this.a(j, mutableint);
if (mutableint.getValue() >= 15) {