geforkt von Mirrors/Paper
ce270e1412
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 Bukkit Changes: b2f1908c SPIGOT-5783: Add helpful info to UnknownDependencyException e4f46260 SPIGOT-2623: Add EntityEquipment methods to get/set ItemStacks by slot. 529a9a69 SPIGOT-5751: Clarify behaviour of block drop-related API methods CraftBukkit Changes:8ea9b138
Remove outdated build delay.ffc2b251
Revert "#675: Fix redirected CommandNodes sometimes not being properly redirected"cb701f6b
#675: Fix redirected CommandNodes sometimes not being properly redirectedc9d7c16b
SPIGOT-2623: Add EntityEquipment methods to get/set ItemStacks by slot.fad2494a
#673: Fix Craftworld#isChunkLoaded8637ec00
SPIGOT-5751: Made breakNaturally and getDrops returns the correct item if no argument is given Spigot Changes: a99063f7 Rebuild patches Fixes #3602
80 Zeilen
3.0 KiB
Diff
80 Zeilen
3.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Spottedleaf <spottedleaf@spottedleaf.dev>
|
|
Date: Mon, 6 Apr 2020 18:10:43 -0700
|
|
Subject: [PATCH] Remove streams from PairedQueue
|
|
|
|
We shouldn't be doing stream calls just to see if the queue is
|
|
empty. This creates loads of garbage thanks to how often it's called.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PairedQueue.java b/src/main/java/net/minecraft/server/PairedQueue.java
|
|
index 85bb22e4b7376b676139048f2d55684e27a54055..2369afb4f37863c5c59456e46c48ad0d32f9eeb7 100644
|
|
--- a/src/main/java/net/minecraft/server/PairedQueue.java
|
|
+++ b/src/main/java/net/minecraft/server/PairedQueue.java
|
|
@@ -20,32 +20,30 @@ public interface PairedQueue<T, F> {
|
|
|
|
public static final class a implements PairedQueue<PairedQueue.b, Runnable> {
|
|
|
|
- private final List<Queue<Runnable>> a;
|
|
+ private final List<Queue<Runnable>> a; private final List<Queue<Runnable>> getQueues() { return this.a; } // Paper - OBFHELPER
|
|
|
|
public a(int i) {
|
|
- this.a = (List) IntStream.range(0, i).mapToObj((j) -> {
|
|
- return Queues.newConcurrentLinkedQueue();
|
|
- }).collect(Collectors.toList());
|
|
+ // Paper start - remove streams
|
|
+ this.a = new java.util.ArrayList<>(i); // queues
|
|
+ for (int j = 0; j < i; ++j) {
|
|
+ this.getQueues().add(Queues.newConcurrentLinkedQueue());
|
|
+ }
|
|
+ // Paper end - remove streams
|
|
}
|
|
|
|
@Nullable
|
|
@Override
|
|
public Runnable a() {
|
|
- Iterator iterator = this.a.iterator();
|
|
-
|
|
- Runnable runnable;
|
|
-
|
|
- do {
|
|
- if (!iterator.hasNext()) {
|
|
- return null;
|
|
+ // Paper start - remove iterator creation
|
|
+ for (int i = 0, len = this.getQueues().size(); i < len; ++i) {
|
|
+ Queue<Runnable> queue = this.getQueues().get(i);
|
|
+ Runnable ret = queue.poll();
|
|
+ if (ret != null) {
|
|
+ return ret;
|
|
}
|
|
-
|
|
- Queue<Runnable> queue = (Queue) iterator.next();
|
|
-
|
|
- runnable = (Runnable) queue.poll();
|
|
- } while (runnable == null);
|
|
-
|
|
- return runnable;
|
|
+ }
|
|
+ return null;
|
|
+ // Paper end - remove iterator creation
|
|
}
|
|
|
|
public boolean a(PairedQueue.b pairedqueue_b) {
|
|
@@ -57,7 +55,16 @@ public interface PairedQueue<T, F> {
|
|
|
|
@Override
|
|
public boolean b() {
|
|
- return this.a.stream().allMatch(Collection::isEmpty);
|
|
+ // Paper start - remove streams
|
|
+ // why are we doing streams every time we might want to execute a task?
|
|
+ for (int i = 0, len = this.getQueues().size(); i < len; ++i) {
|
|
+ Queue<Runnable> queue = this.getQueues().get(i);
|
|
+ if (!queue.isEmpty()) {
|
|
+ return false;
|
|
+ }
|
|
+ }
|
|
+ return true;
|
|
+ // Paper end - remove streams
|
|
}
|
|
}
|
|
|