From 1d64ba8a6b5111bdfa07e3044cc47fc5f229756c Mon Sep 17 00:00:00 2001 From: MartijnMuijsers Date: Wed, 30 Nov 2022 20:55:38 +0100 Subject: [PATCH] Replace AI attributes with optimized collections --- ...ttributes-with-optimized-collections.patch | 49 +++++++++++++++++++ ...> 0068-Cache-BlockStatePairKey-hash.patch} | 0 ...69-Cache-CubeVoxelShape-shape-array.patch} | 0 ...by-multiplication-in-CubePointRange.patch} | 0 ...ace-parts-by-size-in-CubePointRange.patch} | 0 ...k-frozen-ticks-before-landing-block.patch} | 0 ...kip-entity-move-if-movement-is-zero.patch} | 0 ...> 0074-Store-mob-counts-in-an-array.patch} | 0 ...h => 0075-Optimize-noise-generation.patch} | 0 ...durability-change-equipment-updates.patch} | 0 ...es-on-entities-with-fire-resistance.patch} | 0 ...8-Skip-cloning-advancement-criteria.patch} | 0 ...> 0079-Player-canSee-by-entity-UUID.patch} | 0 ...-Spread-out-sending-all-player-info.patch} | 0 ...player-list-for-sending-player-info.patch} | 0 ...dSendEvent-if-there-are-no-listener.patch} | 0 ...83-Send-multiple-keep-alive-packets.patch} | 0 ...m-strolling-into-non-ticking-chunks.patch} | 0 ...h => 0085-Specific-interval-TPS-API.patch} | 0 ....patch => 0086-5-second-TPS-average.patch} | 0 ...atch => 0087-Measure-last-tick-time.patch} | 0 ...PI.patch => 0088-Last-tick-time-API.patch} | 0 ...-Show-last-tick-time-in-tps-command.patch} | 0 ...eck-has-physics-before-same-vehicle.patch} | 0 ...091-Variable-main-thread-task-delay.patch} | 0 ... 0092-Reduce-RandomSource-instances.patch} | 0 ....patch => 0093-CPU-cores-estimation.patch} | 0 ... 0094-Add-centralized-AsyncExecutor.patch} | 0 ...=> 0095-Remove-Paper-async-executor.patch} | 0 ... 0096-Remove-Paper-cleaner-executor.patch} | 0 ... => 0097-Remove-background-executor.patch} | 0 ...h => 0098-Remove-bootstrap-executor.patch} | 0 ...0099-Remove-world-upgrade-executors.patch} | 0 ...> 0100-Remove-tab-complete-executor.patch} | 0 ...=> 0101-Remove-text-filter-executor.patch} | 0 35 files changed, 49 insertions(+) create mode 100644 patches/server/0067-Replace-AI-attributes-with-optimized-collections.patch rename patches/server/{0067-Cache-BlockStatePairKey-hash.patch => 0068-Cache-BlockStatePairKey-hash.patch} (100%) rename patches/server/{0068-Cache-CubeVoxelShape-shape-array.patch => 0069-Cache-CubeVoxelShape-shape-array.patch} (100%) rename patches/server/{0069-Replace-division-by-multiplication-in-CubePointRange.patch => 0070-Replace-division-by-multiplication-in-CubePointRange.patch} (100%) rename patches/server/{0070-Replace-parts-by-size-in-CubePointRange.patch => 0071-Replace-parts-by-size-in-CubePointRange.patch} (100%) rename patches/server/{0071-Check-frozen-ticks-before-landing-block.patch => 0072-Check-frozen-ticks-before-landing-block.patch} (100%) rename patches/server/{0072-Skip-entity-move-if-movement-is-zero.patch => 0073-Skip-entity-move-if-movement-is-zero.patch} (100%) rename patches/server/{0073-Store-mob-counts-in-an-array.patch => 0074-Store-mob-counts-in-an-array.patch} (100%) rename patches/server/{0074-Optimize-noise-generation.patch => 0075-Optimize-noise-generation.patch} (100%) rename patches/server/{0075-Ignore-durability-change-equipment-updates.patch => 0076-Ignore-durability-change-equipment-updates.patch} (100%) rename patches/server/{0076-Hide-flames-on-entities-with-fire-resistance.patch => 0077-Hide-flames-on-entities-with-fire-resistance.patch} (100%) rename patches/server/{0077-Skip-cloning-advancement-criteria.patch => 0078-Skip-cloning-advancement-criteria.patch} (100%) rename patches/server/{0078-Player-canSee-by-entity-UUID.patch => 0079-Player-canSee-by-entity-UUID.patch} (100%) rename patches/server/{0079-Spread-out-sending-all-player-info.patch => 0080-Spread-out-sending-all-player-info.patch} (100%) rename patches/server/{0080-Optimize-player-list-for-sending-player-info.patch => 0081-Optimize-player-list-for-sending-player-info.patch} (100%) rename patches/server/{0081-Skip-PlayerCommandSendEvent-if-there-are-no-listener.patch => 0082-Skip-PlayerCommandSendEvent-if-there-are-no-listener.patch} (100%) rename patches/server/{0082-Send-multiple-keep-alive-packets.patch => 0083-Send-multiple-keep-alive-packets.patch} (100%) rename patches/server/{0083-Prevent-random-strolling-into-non-ticking-chunks.patch => 0084-Prevent-random-strolling-into-non-ticking-chunks.patch} (100%) rename patches/server/{0084-Specific-interval-TPS-API.patch => 0085-Specific-interval-TPS-API.patch} (100%) rename patches/server/{0085-5-second-TPS-average.patch => 0086-5-second-TPS-average.patch} (100%) rename patches/server/{0086-Measure-last-tick-time.patch => 0087-Measure-last-tick-time.patch} (100%) rename patches/server/{0087-Last-tick-time-API.patch => 0088-Last-tick-time-API.patch} (100%) rename patches/server/{0088-Show-last-tick-time-in-tps-command.patch => 0089-Show-last-tick-time-in-tps-command.patch} (100%) rename patches/server/{0089-For-collision-check-has-physics-before-same-vehicle.patch => 0090-For-collision-check-has-physics-before-same-vehicle.patch} (100%) rename patches/server/{0090-Variable-main-thread-task-delay.patch => 0091-Variable-main-thread-task-delay.patch} (100%) rename patches/server/{0091-Reduce-RandomSource-instances.patch => 0092-Reduce-RandomSource-instances.patch} (100%) rename patches/server/{0092-CPU-cores-estimation.patch => 0093-CPU-cores-estimation.patch} (100%) rename patches/server/{0093-Add-centralized-AsyncExecutor.patch => 0094-Add-centralized-AsyncExecutor.patch} (100%) rename patches/server/{0094-Remove-Paper-async-executor.patch => 0095-Remove-Paper-async-executor.patch} (100%) rename patches/server/{0095-Remove-Paper-cleaner-executor.patch => 0096-Remove-Paper-cleaner-executor.patch} (100%) rename patches/server/{0096-Remove-background-executor.patch => 0097-Remove-background-executor.patch} (100%) rename patches/server/{0097-Remove-bootstrap-executor.patch => 0098-Remove-bootstrap-executor.patch} (100%) rename patches/server/{0098-Remove-world-upgrade-executors.patch => 0099-Remove-world-upgrade-executors.patch} (100%) rename patches/server/{0099-Remove-tab-complete-executor.patch => 0100-Remove-tab-complete-executor.patch} (100%) rename patches/server/{0100-Remove-text-filter-executor.patch => 0101-Remove-text-filter-executor.patch} (100%) diff --git a/patches/server/0067-Replace-AI-attributes-with-optimized-collections.patch b/patches/server/0067-Replace-AI-attributes-with-optimized-collections.patch new file mode 100644 index 0000000..46250c3 --- /dev/null +++ b/patches/server/0067-Replace-AI-attributes-with-optimized-collections.patch @@ -0,0 +1,49 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MartijnMuijsers +Date: Wed, 30 Nov 2022 20:54:31 +0100 +Subject: [PATCH] Replace AI attributes with optimized collections + +License: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html) + +This patch is based on the following mixin: +"me/jellysquid/mods/lithium/mixin/collections/attributes/AttributeContainerMixin.java" +By: 2No2Name <2No2Name@web.de> +As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric) +Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.nl.html) + +diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java +index 81eb5e47715312afbedce0786e9a0d4264d32cbd..b0862a0126c642b12d3e17045d39fb704406e295 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java ++++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java +@@ -1,8 +1,6 @@ + package net.minecraft.world.entity.ai.attributes; + +-import com.google.common.collect.Maps; + import com.google.common.collect.Multimap; +-import com.google.common.collect.Sets; + import com.mojang.logging.LogUtils; + import java.util.Collection; + import java.util.Map; +@@ -10,6 +8,9 @@ import java.util.Set; + import java.util.UUID; + import java.util.stream.Collectors; + import javax.annotation.Nullable; ++ ++import it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap; ++import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet; + import net.minecraft.Util; + import net.minecraft.core.Registry; + import net.minecraft.nbt.CompoundTag; +@@ -19,8 +20,10 @@ import org.slf4j.Logger; + + public class AttributeMap { + private static final Logger LOGGER = LogUtils.getLogger(); +- private final Map attributes = Maps.newHashMap(); +- private final Set dirtyAttributes = Sets.newHashSet(); ++ // Gale start - Lithium - replace AI attributes with optimized collections ++ private final Map attributes = new Reference2ReferenceOpenHashMap<>(0); ++ private final Set dirtyAttributes = new ReferenceOpenHashSet<>(0); ++ // Gale end - Lithium - replace AI attributes with optimized collections + private final AttributeSupplier supplier; + private final java.util.function.Function createInstance; // Gale - Airplane - reduce entity allocations + diff --git a/patches/server/0067-Cache-BlockStatePairKey-hash.patch b/patches/server/0068-Cache-BlockStatePairKey-hash.patch similarity index 100% rename from patches/server/0067-Cache-BlockStatePairKey-hash.patch rename to patches/server/0068-Cache-BlockStatePairKey-hash.patch diff --git a/patches/server/0068-Cache-CubeVoxelShape-shape-array.patch b/patches/server/0069-Cache-CubeVoxelShape-shape-array.patch similarity index 100% rename from patches/server/0068-Cache-CubeVoxelShape-shape-array.patch rename to patches/server/0069-Cache-CubeVoxelShape-shape-array.patch diff --git a/patches/server/0069-Replace-division-by-multiplication-in-CubePointRange.patch b/patches/server/0070-Replace-division-by-multiplication-in-CubePointRange.patch similarity index 100% rename from patches/server/0069-Replace-division-by-multiplication-in-CubePointRange.patch rename to patches/server/0070-Replace-division-by-multiplication-in-CubePointRange.patch diff --git a/patches/server/0070-Replace-parts-by-size-in-CubePointRange.patch b/patches/server/0071-Replace-parts-by-size-in-CubePointRange.patch similarity index 100% rename from patches/server/0070-Replace-parts-by-size-in-CubePointRange.patch rename to patches/server/0071-Replace-parts-by-size-in-CubePointRange.patch diff --git a/patches/server/0071-Check-frozen-ticks-before-landing-block.patch b/patches/server/0072-Check-frozen-ticks-before-landing-block.patch similarity index 100% rename from patches/server/0071-Check-frozen-ticks-before-landing-block.patch rename to patches/server/0072-Check-frozen-ticks-before-landing-block.patch diff --git a/patches/server/0072-Skip-entity-move-if-movement-is-zero.patch b/patches/server/0073-Skip-entity-move-if-movement-is-zero.patch similarity index 100% rename from patches/server/0072-Skip-entity-move-if-movement-is-zero.patch rename to patches/server/0073-Skip-entity-move-if-movement-is-zero.patch diff --git a/patches/server/0073-Store-mob-counts-in-an-array.patch b/patches/server/0074-Store-mob-counts-in-an-array.patch similarity index 100% rename from patches/server/0073-Store-mob-counts-in-an-array.patch rename to patches/server/0074-Store-mob-counts-in-an-array.patch diff --git a/patches/server/0074-Optimize-noise-generation.patch b/patches/server/0075-Optimize-noise-generation.patch similarity index 100% rename from patches/server/0074-Optimize-noise-generation.patch rename to patches/server/0075-Optimize-noise-generation.patch diff --git a/patches/server/0075-Ignore-durability-change-equipment-updates.patch b/patches/server/0076-Ignore-durability-change-equipment-updates.patch similarity index 100% rename from patches/server/0075-Ignore-durability-change-equipment-updates.patch rename to patches/server/0076-Ignore-durability-change-equipment-updates.patch diff --git a/patches/server/0076-Hide-flames-on-entities-with-fire-resistance.patch b/patches/server/0077-Hide-flames-on-entities-with-fire-resistance.patch similarity index 100% rename from patches/server/0076-Hide-flames-on-entities-with-fire-resistance.patch rename to patches/server/0077-Hide-flames-on-entities-with-fire-resistance.patch diff --git a/patches/server/0077-Skip-cloning-advancement-criteria.patch b/patches/server/0078-Skip-cloning-advancement-criteria.patch similarity index 100% rename from patches/server/0077-Skip-cloning-advancement-criteria.patch rename to patches/server/0078-Skip-cloning-advancement-criteria.patch diff --git a/patches/server/0078-Player-canSee-by-entity-UUID.patch b/patches/server/0079-Player-canSee-by-entity-UUID.patch similarity index 100% rename from patches/server/0078-Player-canSee-by-entity-UUID.patch rename to patches/server/0079-Player-canSee-by-entity-UUID.patch diff --git a/patches/server/0079-Spread-out-sending-all-player-info.patch b/patches/server/0080-Spread-out-sending-all-player-info.patch similarity index 100% rename from patches/server/0079-Spread-out-sending-all-player-info.patch rename to patches/server/0080-Spread-out-sending-all-player-info.patch diff --git a/patches/server/0080-Optimize-player-list-for-sending-player-info.patch b/patches/server/0081-Optimize-player-list-for-sending-player-info.patch similarity index 100% rename from patches/server/0080-Optimize-player-list-for-sending-player-info.patch rename to patches/server/0081-Optimize-player-list-for-sending-player-info.patch diff --git a/patches/server/0081-Skip-PlayerCommandSendEvent-if-there-are-no-listener.patch b/patches/server/0082-Skip-PlayerCommandSendEvent-if-there-are-no-listener.patch similarity index 100% rename from patches/server/0081-Skip-PlayerCommandSendEvent-if-there-are-no-listener.patch rename to patches/server/0082-Skip-PlayerCommandSendEvent-if-there-are-no-listener.patch diff --git a/patches/server/0082-Send-multiple-keep-alive-packets.patch b/patches/server/0083-Send-multiple-keep-alive-packets.patch similarity index 100% rename from patches/server/0082-Send-multiple-keep-alive-packets.patch rename to patches/server/0083-Send-multiple-keep-alive-packets.patch diff --git a/patches/server/0083-Prevent-random-strolling-into-non-ticking-chunks.patch b/patches/server/0084-Prevent-random-strolling-into-non-ticking-chunks.patch similarity index 100% rename from patches/server/0083-Prevent-random-strolling-into-non-ticking-chunks.patch rename to patches/server/0084-Prevent-random-strolling-into-non-ticking-chunks.patch diff --git a/patches/server/0084-Specific-interval-TPS-API.patch b/patches/server/0085-Specific-interval-TPS-API.patch similarity index 100% rename from patches/server/0084-Specific-interval-TPS-API.patch rename to patches/server/0085-Specific-interval-TPS-API.patch diff --git a/patches/server/0085-5-second-TPS-average.patch b/patches/server/0086-5-second-TPS-average.patch similarity index 100% rename from patches/server/0085-5-second-TPS-average.patch rename to patches/server/0086-5-second-TPS-average.patch diff --git a/patches/server/0086-Measure-last-tick-time.patch b/patches/server/0087-Measure-last-tick-time.patch similarity index 100% rename from patches/server/0086-Measure-last-tick-time.patch rename to patches/server/0087-Measure-last-tick-time.patch diff --git a/patches/server/0087-Last-tick-time-API.patch b/patches/server/0088-Last-tick-time-API.patch similarity index 100% rename from patches/server/0087-Last-tick-time-API.patch rename to patches/server/0088-Last-tick-time-API.patch diff --git a/patches/server/0088-Show-last-tick-time-in-tps-command.patch b/patches/server/0089-Show-last-tick-time-in-tps-command.patch similarity index 100% rename from patches/server/0088-Show-last-tick-time-in-tps-command.patch rename to patches/server/0089-Show-last-tick-time-in-tps-command.patch diff --git a/patches/server/0089-For-collision-check-has-physics-before-same-vehicle.patch b/patches/server/0090-For-collision-check-has-physics-before-same-vehicle.patch similarity index 100% rename from patches/server/0089-For-collision-check-has-physics-before-same-vehicle.patch rename to patches/server/0090-For-collision-check-has-physics-before-same-vehicle.patch diff --git a/patches/server/0090-Variable-main-thread-task-delay.patch b/patches/server/0091-Variable-main-thread-task-delay.patch similarity index 100% rename from patches/server/0090-Variable-main-thread-task-delay.patch rename to patches/server/0091-Variable-main-thread-task-delay.patch diff --git a/patches/server/0091-Reduce-RandomSource-instances.patch b/patches/server/0092-Reduce-RandomSource-instances.patch similarity index 100% rename from patches/server/0091-Reduce-RandomSource-instances.patch rename to patches/server/0092-Reduce-RandomSource-instances.patch diff --git a/patches/server/0092-CPU-cores-estimation.patch b/patches/server/0093-CPU-cores-estimation.patch similarity index 100% rename from patches/server/0092-CPU-cores-estimation.patch rename to patches/server/0093-CPU-cores-estimation.patch diff --git a/patches/server/0093-Add-centralized-AsyncExecutor.patch b/patches/server/0094-Add-centralized-AsyncExecutor.patch similarity index 100% rename from patches/server/0093-Add-centralized-AsyncExecutor.patch rename to patches/server/0094-Add-centralized-AsyncExecutor.patch diff --git a/patches/server/0094-Remove-Paper-async-executor.patch b/patches/server/0095-Remove-Paper-async-executor.patch similarity index 100% rename from patches/server/0094-Remove-Paper-async-executor.patch rename to patches/server/0095-Remove-Paper-async-executor.patch diff --git a/patches/server/0095-Remove-Paper-cleaner-executor.patch b/patches/server/0096-Remove-Paper-cleaner-executor.patch similarity index 100% rename from patches/server/0095-Remove-Paper-cleaner-executor.patch rename to patches/server/0096-Remove-Paper-cleaner-executor.patch diff --git a/patches/server/0096-Remove-background-executor.patch b/patches/server/0097-Remove-background-executor.patch similarity index 100% rename from patches/server/0096-Remove-background-executor.patch rename to patches/server/0097-Remove-background-executor.patch diff --git a/patches/server/0097-Remove-bootstrap-executor.patch b/patches/server/0098-Remove-bootstrap-executor.patch similarity index 100% rename from patches/server/0097-Remove-bootstrap-executor.patch rename to patches/server/0098-Remove-bootstrap-executor.patch diff --git a/patches/server/0098-Remove-world-upgrade-executors.patch b/patches/server/0099-Remove-world-upgrade-executors.patch similarity index 100% rename from patches/server/0098-Remove-world-upgrade-executors.patch rename to patches/server/0099-Remove-world-upgrade-executors.patch diff --git a/patches/server/0099-Remove-tab-complete-executor.patch b/patches/server/0100-Remove-tab-complete-executor.patch similarity index 100% rename from patches/server/0099-Remove-tab-complete-executor.patch rename to patches/server/0100-Remove-tab-complete-executor.patch diff --git a/patches/server/0100-Remove-text-filter-executor.patch b/patches/server/0101-Remove-text-filter-executor.patch similarity index 100% rename from patches/server/0100-Remove-text-filter-executor.patch rename to patches/server/0101-Remove-text-filter-executor.patch