From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: ishland Date: Sun, 20 Sep 2020 00:05:44 +0800 Subject: [PATCH] Improve task performance Replace ConcurrentLinkedQueue + LockSupport hack to reduce time consumption of addTask(R)V Co-authored-by: Mykyta Komarn diff --git a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java index 5df6be7e8d9b1295ed0700b3be90c3778fc7d77c..cbc03b8bc34e244c08a85bfd681707a49d1046f9 100644 --- a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java +++ b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java @@ -13,9 +13,11 @@ public abstract class IAsyncTaskHandler implements Mailbox d = Queues.newConcurrentLinkedQueue(); + private final java.util.concurrent.BlockingDeque d = new java.util.concurrent.LinkedBlockingDeque<>(); // Yatopia - improve task performance private int e; + private R next = null; // Yatopia - improve task performance - temp storage for next object + protected IAsyncTaskHandler(String s) { this.b = s; } @@ -79,7 +81,7 @@ public abstract class IAsyncTaskHandler implements Mailbox implements Mailbox implements Mailbox