geforkt von Mirrors/Paper
c97ce029e9
PaperMC believes that 1.16.2 is now ready for general release as we fixed the main issue plagueing the 1.16.x release, the MapLike data conversion issues. Until now, it was not safe for a server to convert a world to 1.16.2 without data conversion issues around villages and potentially other things. If you did, those MapLike errors meant something went wrong. This is now resolved. Big thanks to all those that helped, notably @BillyGalbreath and @Proximyst who did large parts of the update process with me. Please as always, backup your worlds and test before updating to 1.16.2! If you update to 1.16.2, there is no going back to an older build than this. --------------------------------- Co-authored-by: William Blake Galbreath <Blake.Galbreath@GMail.com> Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com> Co-authored-by: krolik-exe <69214078+krolik-exe@users.noreply.github.com> Co-authored-by: BillyGalbreath <BillyGalbreath@users.noreply.github.com> Co-authored-by: stonar96 <minecraft.stonar96@gmail.com> Co-authored-by: Shane Freeder <theboyetronic@gmail.com> Co-authored-by: Jason <jasonpenilla2@me.com> Co-authored-by: kashike <kashike@vq.lc> Co-authored-by: Aurora <21148213+aurorasmiles@users.noreply.github.com> Co-authored-by: KennyTV <kennytv@t-online.de> Co-authored-by: commandblockguy <commandblockguy1@gmail.com> Co-authored-by: DigitalRegent <misterwener@gmail.com> Co-authored-by: ishland <ishlandmc@yeah.net>
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
|
|
}
|
|
}
|
|
|