Cache resource keys and optimize reference Holder tags set

TagKeys are always interned, so we can use a reference hash set for them
This commit is contained in:
Jake Potrebic
2022-03-20 22:06:47 -07:00
parent 636e993d37
commit 96c7383ba4
2 changed files with 13 additions and 2 deletions

View File

@@ -0,0 +1,11 @@
--- a/net/minecraft/core/Holder.java
+++ b/net/minecraft/core/Holder.java
@@ -230,7 +230,7 @@
}
void bindTags(Collection<TagKey<T>> tags) {
- this.tags = Set.copyOf(tags);
+ this.tags = java.util.Collections.unmodifiableSet(new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<>(tags)); // Paper
}
@Override