diff --git a/Spigot-Server-Patches/0360-Fix-concurrency-and-performance-issues-in-DataFixers.patch b/Spigot-Server-Patches/0360-Fix-concurrency-and-performance-issues-in-DataFixers.patch index a424b25355..622ff2c907 100644 --- a/Spigot-Server-Patches/0360-Fix-concurrency-and-performance-issues-in-DataFixers.patch +++ b/Spigot-Server-Patches/0360-Fix-concurrency-and-performance-issues-in-DataFixers.patch @@ -1,4 +1,4 @@ -From a694ddcd284ff29b441f5fc14a37b13f3f24fa73 Mon Sep 17 00:00:00 2001 +From a0647a441898664025560ad39980647620736867 Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 3 Sep 2018 22:18:38 -0400 Subject: [PATCH] Fix concurrency and performance issues in DataFixers @@ -24,7 +24,7 @@ Additionally, many of the containsKey/get/put style operations were also a concurrency risk, resulting in multiple computation/insertions. diff --git a/src/main/java/com/mojang/datafixers/DataFixerUpper.java b/src/main/java/com/mojang/datafixers/DataFixerUpper.java -index fb2c380f8a..a4922a35a2 100644 +index fb2c380f8..a4922a35a 100644 --- a/src/main/java/com/mojang/datafixers/DataFixerUpper.java +++ b/src/main/java/com/mojang/datafixers/DataFixerUpper.java @@ -65,7 +65,7 @@ public class DataFixerUpper implements DataFixer { @@ -58,7 +58,7 @@ index fb2c380f8a..a4922a35a2 100644 protected IntSortedSet fixerVersions() { diff --git a/src/main/java/com/mojang/datafixers/NamedChoiceFinder.java b/src/main/java/com/mojang/datafixers/NamedChoiceFinder.java -index 2c259d74e9..17481fb6e6 100644 +index 2c259d74e..17481fb6e 100644 --- a/src/main/java/com/mojang/datafixers/NamedChoiceFinder.java +++ b/src/main/java/com/mojang/datafixers/NamedChoiceFinder.java @@ -71,8 +71,10 @@ final class NamedChoiceFinder implements OpticFinder { @@ -75,7 +75,7 @@ index 2c259d74e9..17481fb6e6 100644 return Either.right(new Type.FieldNotFoundException(String.format("Type error for choice type \"%s\": expected type: %s, actual type: %s)", name, targetType, elementType))); } diff --git a/src/main/java/com/mojang/datafixers/functions/PointFree.java b/src/main/java/com/mojang/datafixers/functions/PointFree.java -index 0d88490f77..028942b8ea 100644 +index 0d88490f7..028942b8e 100644 --- a/src/main/java/com/mojang/datafixers/functions/PointFree.java +++ b/src/main/java/com/mojang/datafixers/functions/PointFree.java @@ -14,7 +14,7 @@ public abstract class PointFree { @@ -88,7 +88,7 @@ index 0d88490f77..028942b8ea 100644 initialized = true; value = eval(); diff --git a/src/main/java/com/mojang/datafixers/schemas/Schema.java b/src/main/java/com/mojang/datafixers/schemas/Schema.java -index 7c67d989e0..f1fd694b06 100644 +index 7c67d989e..7faca88a8 100644 --- a/src/main/java/com/mojang/datafixers/schemas/Schema.java +++ b/src/main/java/com/mojang/datafixers/schemas/Schema.java @@ -20,8 +20,8 @@ import java.util.function.Function; @@ -153,23 +153,7 @@ index 7c67d989e0..f1fd694b06 100644 } return getTemplate(name); } -@@ -101,10 +109,13 @@ public class Schema { - - public Type getChoiceType(final DSL.TypeReference type, final String choiceName) { - final TaggedChoice.TaggedChoiceType choiceType = findChoiceType(type); -- if (!choiceType.types().containsKey(choiceName)) { -+ // Paper start - performance and concurrency - don't use containsKey -+ Type result = choiceType.types().get(choiceName); -+ if (result == null) { - throw new IllegalArgumentException("Data fixer not registered for: " + choiceName + " in " + type.typeName()); - } -- return choiceType.types().get(choiceName); -+ return result; -+ // Paper end - } - - public TaggedChoice.TaggedChoiceType findChoiceType(final DSL.TypeReference type) { -@@ -138,9 +149,10 @@ public class Schema { +@@ -138,9 +146,10 @@ public class Schema { public void registerType(final boolean recursive, final DSL.TypeReference type, final Supplier template) { TYPE_TEMPLATES.put(type.typeName(), template); // TODO: calculate recursiveness instead of hardcoding @@ -182,7 +166,7 @@ index 7c67d989e0..f1fd694b06 100644 public int getVersionKey() { diff --git a/src/main/java/com/mojang/datafixers/types/DynamicOps.java b/src/main/java/com/mojang/datafixers/types/DynamicOps.java -index 3c76929f24..f21531b3cd 100644 +index 3c76929f2..f21531b3c 100644 --- a/src/main/java/com/mojang/datafixers/types/DynamicOps.java +++ b/src/main/java/com/mojang/datafixers/types/DynamicOps.java @@ -151,10 +151,10 @@ public interface DynamicOps { @@ -201,7 +185,7 @@ index 3c76929f24..f21531b3cd 100644 } diff --git a/src/main/java/com/mojang/datafixers/types/Type.java b/src/main/java/com/mojang/datafixers/types/Type.java -index a80e3fee91..2d5bae7a37 100644 +index a80e3fee9..2d5bae7a3 100644 --- a/src/main/java/com/mojang/datafixers/types/Type.java +++ b/src/main/java/com/mojang/datafixers/types/Type.java @@ -27,8 +27,10 @@ import javax.annotation.Nullable; @@ -254,7 +238,7 @@ index a80e3fee91..2d5bae7a37 100644 public Type getSetType(final OpticFinder optic, final Type newType) { diff --git a/src/main/java/com/mojang/datafixers/types/families/RecursiveTypeFamily.java b/src/main/java/com/mojang/datafixers/types/families/RecursiveTypeFamily.java -index 4a1f906837..93c2f565fd 100644 +index 4a1f90683..93c2f565f 100644 --- a/src/main/java/com/mojang/datafixers/types/families/RecursiveTypeFamily.java +++ b/src/main/java/com/mojang/datafixers/types/families/RecursiveTypeFamily.java @@ -32,7 +32,7 @@ public final class RecursiveTypeFamily implements TypeFamily { @@ -267,7 +251,7 @@ index 4a1f906837..93c2f565fd 100644 public RecursiveTypeFamily(final String name, final TypeTemplate template) { diff --git a/src/main/java/com/mojang/datafixers/types/templates/Tag.java b/src/main/java/com/mojang/datafixers/types/templates/Tag.java -index ece3fb5f88..396637bbd1 100644 +index ece3fb5f8..396637bbd 100644 --- a/src/main/java/com/mojang/datafixers/types/templates/Tag.java +++ b/src/main/java/com/mojang/datafixers/types/templates/Tag.java @@ -173,8 +173,10 @@ public final class Tag implements TypeTemplate { @@ -284,7 +268,7 @@ index ece3fb5f88..396637bbd1 100644 if (value.isPresent()) { return Pair.of(ops.createMap(map.get().entrySet().stream().filter(e -> !Objects.equals(e.getKey(), nameObject)).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))), value); diff --git a/src/main/java/com/mojang/datafixers/types/templates/TaggedChoice.java b/src/main/java/com/mojang/datafixers/types/templates/TaggedChoice.java -index e6dd31233a..77d64362b1 100644 +index e6dd31233..77d64362b 100644 --- a/src/main/java/com/mojang/datafixers/types/templates/TaggedChoice.java +++ b/src/main/java/com/mojang/datafixers/types/templates/TaggedChoice.java @@ -187,17 +187,25 @@ public final class TaggedChoice implements TypeTemplate { @@ -337,5 +321,5 @@ index e6dd31233a..77d64362b1 100644 } -- -2.19.0 +2.18.0