mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
062733b903
Doesn't compile yet. CraftBukkit Changes: 90d6905b Repackage NMS 69cf961d Repackage patches Spigot Changes: 79d53c28 Repackage NMS
50 lines
3 KiB
Diff
50 lines
3 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/world/level/lighting/LightEngineBlock.java b/src/main/java/net/minecraft/world/level/lighting/LightEngineBlock.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/world/level/lighting/LightEngineBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/lighting/LightEngineBlock.java
|
|
@@ -0,0 +0,0 @@ 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));
|
|
@@ -0,0 +0,0 @@ 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/world/level/lighting/LightEngineSky.java b/src/main/java/net/minecraft/world/level/lighting/LightEngineSky.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/world/level/lighting/LightEngineSky.java
|
|
+++ b/src/main/java/net/minecraft/world/level/lighting/LightEngineSky.java
|
|
@@ -0,0 +0,0 @@ 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));
|
|
@@ -0,0 +0,0 @@ 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) {
|