9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2026-01-04 15:41:40 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0194-Avoid-useless-deque-clear-on-LevelTicks-cleanupAfter.patch
Dreeam 9a4efaa230 Drop patch that causes performance regression
Originally vanilla logic is to use stream, and Mojang switched it to Guava's Collections2
since 1.21.4. It is much faster than using stream or manually adding to a new ArrayList.
Manually adding to a new ArrayList requires allocating a new object array. However, the Collections2
lazy handles filter condition on iteration, so much better.
2025-08-04 19:25:56 +08:00

20 lines
987 B
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MachineBreaker <saltspigotpp@gmail.com>
Date: Wed, 16 Oct 2024 03:39:24 -0400
Subject: [PATCH] Avoid useless deque clear on LevelTicks#cleanupAfterTick
diff --git a/net/minecraft/world/ticks/LevelTicks.java b/net/minecraft/world/ticks/LevelTicks.java
index 9dc03a8fff08111b6a68aa94d658f1e965ef0d25..0f3848bf82f35fa3988267c7bfa18e1b34d97b66 100644
--- a/net/minecraft/world/ticks/LevelTicks.java
+++ b/net/minecraft/world/ticks/LevelTicks.java
@@ -182,7 +182,7 @@ public class LevelTicks<T> implements LevelTickAccess<T> {
}
private void cleanupAfterTick() {
- this.toRunThisTick.clear();
+ //this.toRunThisTick.clear(); // Leaf - Avoid useless deque clear on LevelTicks#cleanupAfterTick - This method runs after toRunThisTick is polled so this is always empty
this.containersToTick.clear();
this.alreadyRunThisTick.clear();
this.toRunThisTickSet.clear();