diff options
Diffstat (limited to 'patches/server/0419-Optimize-brigadier-child-sorting-performance.patch')
-rw-r--r-- | patches/server/0419-Optimize-brigadier-child-sorting-performance.patch | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/patches/server/0419-Optimize-brigadier-child-sorting-performance.patch b/patches/server/0419-Optimize-brigadier-child-sorting-performance.patch new file mode 100644 index 0000000000..3dd2ebd6a4 --- /dev/null +++ b/patches/server/0419-Optimize-brigadier-child-sorting-performance.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: virustotalop <[email protected]> +Date: Thu, 16 Apr 2020 20:51:32 -0700 +Subject: [PATCH] Optimize brigadier child sorting performance + + +diff --git a/src/main/java/com/mojang/brigadier/tree/CommandNode.java b/src/main/java/com/mojang/brigadier/tree/CommandNode.java +index 2dd09c97e00d877f5f3beed9583d3fdabc88e181..2b87c6eb28d4db634dd6d8ee42ff3aa78ed7cb68 100644 +--- a/src/main/java/com/mojang/brigadier/tree/CommandNode.java ++++ b/src/main/java/com/mojang/brigadier/tree/CommandNode.java +@@ -26,7 +26,7 @@ import java.util.stream.Collectors; + import net.minecraft.commands.CommandSourceStack; + + public abstract class CommandNode<S> implements Comparable<CommandNode<S>> { +- private Map<String, CommandNode<S>> children = Maps.newLinkedHashMap(); ++ private Map<String, CommandNode<S>> children = Maps.newTreeMap(); // Paper - Switch to tree map for automatic sorting + private Map<String, LiteralCommandNode<S>> literals = Maps.newLinkedHashMap(); + private Map<String, ArgumentCommandNode<S, ?>> arguments = Maps.newLinkedHashMap(); + public Predicate<S> requirement; +@@ -107,7 +107,7 @@ public abstract class CommandNode<S> implements Comparable<CommandNode<S>> { + } + } + +- this.children = this.children.entrySet().stream().sorted(Map.Entry.comparingByValue()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new)); ++ // Paper - Remove manual sorting, it is no longer needed + } + + public void findAmbiguities(final AmbiguityConsumer<S> consumer) { |