Fix patch "Faster redstone torch rapid clock removal" (#2014)

Tux pointed out the patch still has O(n^2) time complexity since
the sublist class in arraylist does not override clear() from
AbstractList, which uses a forward moving iterator to clear
the list.

Resolved by using a peek and poll from ArrayDeque.

This patch also removes the useless WeakHashMap which holds
the list (it mapped world->list) and replaces it with a
field on World.
This commit is contained in:
Spottedleaf 2019-05-10 08:48:58 -07:00 committed by Shane Freeder
commit 994679a0c9
13 changed files with 113 additions and 63 deletions

View file

@ -1,14 +1,14 @@
From 38a4833f0693fd44bd6be0fd00b32ad98af60dd0 Mon Sep 17 00:00:00 2001
From 898e971f01f728b6ddddda340224e41a63a39a53 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Tue, 1 Jan 2019 02:22:01 -0800
Subject: [PATCH] Add Heightmap API
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 235440c651..cae59ed377 100644
index a1e660767..4caf5d9af 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -616,8 +616,8 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
@@ -617,8 +617,8 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
}
}
@ -20,7 +20,7 @@ index 235440c651..cae59ed377 100644
if (i >= -30000000 && j >= -30000000 && i < 30000000 && j < 30000000) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index ed646bc9db..d2c3ea0dc3 100644
index b9786909b..cd3814cdd 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -317,6 +317,29 @@ public class CraftWorld implements World {