2020-05-17 04:05:14 +02:00
|
|
|
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
|
|
|
|
|
2020-06-05 07:25:11 +02:00
|
|
|
We can abuse the fact light is single threaded and share an instance
|
|
|
|
per light engine instance
|
2020-05-17 04:05:14 +02:00
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/LightEngineBlock.java b/src/main/java/net/minecraft/server/LightEngineBlock.java
|
|
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
|
|
--- a/src/main/java/net/minecraft/server/LightEngineBlock.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/LightEngineBlock.java
|
2020-06-05 07:25:11 +02:00
|
|
|
@@ -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));
|
2020-05-17 04:05:14 +02:00
|
|
|
@@ -0,0 +0,0 @@ public final class LightEngineBlock extends LightEngineLayer<LightEngineStorageB
|
|
|
|
if (enumdirection == null) {
|
|
|
|
return 15;
|
|
|
|
} else {
|
|
|
|
- MutableInt mutableint = new MutableInt();
|
2020-06-05 07:25:11 +02:00
|
|
|
+ //MutableInt mutableint = new MutableInt(); // Paper - share mutableint, single threaded
|
2020-05-17 04:05:14 +02:00
|
|
|
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
|
|
--- a/src/main/java/net/minecraft/server/LightEngineSky.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/LightEngineSky.java
|
2020-06-05 07:25:11 +02:00
|
|
|
@@ -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));
|
2020-05-17 04:05:14 +02:00
|
|
|
@@ -0,0 +0,0 @@ public final class LightEngineSky extends LightEngineLayer<LightEngineStorageSky
|
|
|
|
if (k >= 15) {
|
|
|
|
return k;
|
|
|
|
} else {
|
|
|
|
- MutableInt mutableint = new MutableInt();
|
2020-06-05 07:25:11 +02:00
|
|
|
+ //MutableInt mutableint = new MutableInt(); // Paper - share mutableint, single threaded
|
2020-05-17 04:05:14 +02:00
|
|
|
IBlockData iblockdata = this.a(j, mutableint);
|
|
|
|
|
|
|
|
if (mutableint.getValue() >= 15) {
|