mirror of
https://github.com/SparklyPower/SparklyPaper.git
synced 2025-12-19 15:09:27 +00:00
31 lines
1.5 KiB
Diff
31 lines
1.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Paul <paul@technove.co>
|
|
Date: Fri, 2 Jul 2021 17:02:32 -0500
|
|
Subject: [PATCH] Quicker sequencing of futures for chunk gen
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
|
|
index 505546d32eea4682452dbac02311433157f6a30e..5c7b9ad379f3c272e15648dd16f4df9245d927da 100644
|
|
--- a/src/main/java/net/minecraft/Util.java
|
|
+++ b/src/main/java/net/minecraft/Util.java
|
|
@@ -344,6 +344,10 @@ public class Util {
|
|
}
|
|
|
|
public static <V> CompletableFuture<List<V>> sequence(List<? extends CompletableFuture<? extends V>> futures) {
|
|
+ // Airplane start - faster sequencing without all of.. _that_
|
|
+ return CompletableFuture.allOf(futures.toArray(new CompletableFuture[futures.size()]))
|
|
+ .thenApply(unused -> futures.stream().map(CompletableFuture::join).collect(Collectors.toList()));
|
|
+ /*
|
|
return futures.stream().reduce(CompletableFuture.completedFuture(Lists.newArrayList()), (completableFuture, completableFuture2) -> {
|
|
return completableFuture2.thenCombine(completableFuture, (object, list) -> {
|
|
List<V> list2 = Lists.newArrayListWithCapacity(list.size() + 1);
|
|
@@ -359,6 +363,8 @@ public class Util {
|
|
return list3;
|
|
});
|
|
});
|
|
+ */
|
|
+ // Airplane end
|
|
}
|
|
|
|
public static <V> CompletableFuture<List<V>> sequenceFailFast(List<? extends CompletableFuture<? extends V>> futures) {
|