From 1ef0a44bc9e4940abaeaaf0e11f3b2d5faa5c70a Mon Sep 17 00:00:00 2001 From: MartijnMuijsers Date: Wed, 30 Nov 2022 15:57:42 +0100 Subject: [PATCH] Cache BlockStatePairKey hash --- .../0066-Cache-BlockStatePairKey-hash.patch | 50 +++++++++++++++++++ ...kip-entity-move-if-movement-is-zero.patch} | 0 ...durability-change-equipment-updates.patch} | 0 ...es-on-entities-with-fire-resistance.patch} | 0 ...> 0070-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 ...74-Send-multiple-keep-alive-packets.patch} | 0 ...h => 0075-Specific-interval-TPS-API.patch} | 0 ....patch => 0076-5-second-TPS-average.patch} | 0 ...atch => 0077-Measure-last-tick-time.patch} | 0 ...PI.patch => 0078-Last-tick-time-API.patch} | 0 ...-Show-last-tick-time-in-tps-command.patch} | 0 ...-physics-check-before-vehicle-check.patch} | 0 ...081-Variable-main-thread-task-delay.patch} | 0 ... 0082-Reduce-RandomSource-instances.patch} | 0 ....patch => 0083-CPU-cores-estimation.patch} | 0 ... 0084-Add-centralized-AsyncExecutor.patch} | 0 ...=> 0085-Remove-Paper-async-executor.patch} | 0 ... 0086-Remove-Paper-cleaner-executor.patch} | 0 ... => 0087-Remove-background-executor.patch} | 0 ...h => 0088-Remove-bootstrap-executor.patch} | 0 ...0089-Remove-world-upgrade-executors.patch} | 0 ...> 0090-Remove-tab-complete-executor.patch} | 0 ...=> 0091-Remove-text-filter-executor.patch} | 0 26 files changed, 50 insertions(+) create mode 100644 patches/server/0066-Cache-BlockStatePairKey-hash.patch rename patches/server/{0066-Skip-entity-move-if-movement-is-zero.patch => 0067-Skip-entity-move-if-movement-is-zero.patch} (100%) rename patches/server/{0067-Ignore-durability-change-equipment-updates.patch => 0068-Ignore-durability-change-equipment-updates.patch} (100%) rename patches/server/{0068-Hide-flames-on-entities-with-fire-resistance.patch => 0069-Hide-flames-on-entities-with-fire-resistance.patch} (100%) rename patches/server/{0069-Player-canSee-by-entity-UUID.patch => 0070-Player-canSee-by-entity-UUID.patch} (100%) rename patches/server/{0070-Spread-out-sending-all-player-info.patch => 0071-Spread-out-sending-all-player-info.patch} (100%) rename patches/server/{0071-Optimize-player-list-for-sending-player-info.patch => 0072-Optimize-player-list-for-sending-player-info.patch} (100%) rename patches/server/{0072-Skip-PlayerCommandSendEvent-if-there-are-no-listener.patch => 0073-Skip-PlayerCommandSendEvent-if-there-are-no-listener.patch} (100%) rename patches/server/{0073-Send-multiple-keep-alive-packets.patch => 0074-Send-multiple-keep-alive-packets.patch} (100%) rename patches/server/{0074-Specific-interval-TPS-API.patch => 0075-Specific-interval-TPS-API.patch} (100%) rename patches/server/{0075-5-second-TPS-average.patch => 0076-5-second-TPS-average.patch} (100%) rename patches/server/{0076-Measure-last-tick-time.patch => 0077-Measure-last-tick-time.patch} (100%) rename patches/server/{0077-Last-tick-time-API.patch => 0078-Last-tick-time-API.patch} (100%) rename patches/server/{0078-Show-last-tick-time-in-tps-command.patch => 0079-Show-last-tick-time-in-tps-command.patch} (100%) rename patches/server/{0079-Collision-physics-check-before-vehicle-check.patch => 0080-Collision-physics-check-before-vehicle-check.patch} (100%) rename patches/server/{0080-Variable-main-thread-task-delay.patch => 0081-Variable-main-thread-task-delay.patch} (100%) rename patches/server/{0081-Reduce-RandomSource-instances.patch => 0082-Reduce-RandomSource-instances.patch} (100%) rename patches/server/{0082-CPU-cores-estimation.patch => 0083-CPU-cores-estimation.patch} (100%) rename patches/server/{0083-Add-centralized-AsyncExecutor.patch => 0084-Add-centralized-AsyncExecutor.patch} (100%) rename patches/server/{0084-Remove-Paper-async-executor.patch => 0085-Remove-Paper-async-executor.patch} (100%) rename patches/server/{0085-Remove-Paper-cleaner-executor.patch => 0086-Remove-Paper-cleaner-executor.patch} (100%) rename patches/server/{0086-Remove-background-executor.patch => 0087-Remove-background-executor.patch} (100%) rename patches/server/{0087-Remove-bootstrap-executor.patch => 0088-Remove-bootstrap-executor.patch} (100%) rename patches/server/{0088-Remove-world-upgrade-executors.patch => 0089-Remove-world-upgrade-executors.patch} (100%) rename patches/server/{0089-Remove-tab-complete-executor.patch => 0090-Remove-tab-complete-executor.patch} (100%) rename patches/server/{0090-Remove-text-filter-executor.patch => 0091-Remove-text-filter-executor.patch} (100%) diff --git a/patches/server/0066-Cache-BlockStatePairKey-hash.patch b/patches/server/0066-Cache-BlockStatePairKey-hash.patch new file mode 100644 index 0000000..5b9c08b --- /dev/null +++ b/patches/server/0066-Cache-BlockStatePairKey-hash.patch @@ -0,0 +1,50 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MartijnMuijsers +Date: Wed, 30 Nov 2022 15:51:59 +0100 +Subject: [PATCH] Cache BlockStatePairKey hash + +License: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html) + +This patch is based on the following mixin: +"cached_hashcode/BlockNeighborGroupMixin" +Original commit: "Initial commit" +By: Angeline +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/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java +index 2e65b44f10aeb44fd524a58e7eb815a566c1ad61..f8fe7b5ae8ef93902c7bb80dddacf790ee56a698 100644 +--- a/src/main/java/net/minecraft/world/level/block/Block.java ++++ b/src/main/java/net/minecraft/world/level/block/Block.java +@@ -612,11 +612,18 @@ public class Block extends BlockBehaviour implements ItemLike { + private final BlockState first; + private final BlockState second; + private final Direction direction; ++ private final int hash; // Gale - Lithium - cache BlockStatePairKey hash + + public BlockStatePairKey(BlockState self, BlockState other, Direction facing) { + this.first = self; + this.second = other; + this.direction = facing; ++ // Gale start - Lithium - cache BlockStatePairKey hash ++ int hash = this.first.hashCode(); ++ hash = 31 * hash + this.second.hashCode(); ++ hash = 31 * hash + this.direction.hashCode(); ++ this.hash = hash; ++ // Gale end - Lithium - cache BlockStatePairKey hash + } + + public boolean equals(Object object) { +@@ -632,11 +639,7 @@ public class Block extends BlockBehaviour implements ItemLike { + } + + public int hashCode() { +- int i = this.first.hashCode(); +- +- i = 31 * i + this.second.hashCode(); +- i = 31 * i + this.direction.hashCode(); +- return i; ++ return this.hash; // Gale - Lithium - cache BlockStatePairKey hash + } + } + } diff --git a/patches/server/0066-Skip-entity-move-if-movement-is-zero.patch b/patches/server/0067-Skip-entity-move-if-movement-is-zero.patch similarity index 100% rename from patches/server/0066-Skip-entity-move-if-movement-is-zero.patch rename to patches/server/0067-Skip-entity-move-if-movement-is-zero.patch diff --git a/patches/server/0067-Ignore-durability-change-equipment-updates.patch b/patches/server/0068-Ignore-durability-change-equipment-updates.patch similarity index 100% rename from patches/server/0067-Ignore-durability-change-equipment-updates.patch rename to patches/server/0068-Ignore-durability-change-equipment-updates.patch diff --git a/patches/server/0068-Hide-flames-on-entities-with-fire-resistance.patch b/patches/server/0069-Hide-flames-on-entities-with-fire-resistance.patch similarity index 100% rename from patches/server/0068-Hide-flames-on-entities-with-fire-resistance.patch rename to patches/server/0069-Hide-flames-on-entities-with-fire-resistance.patch diff --git a/patches/server/0069-Player-canSee-by-entity-UUID.patch b/patches/server/0070-Player-canSee-by-entity-UUID.patch similarity index 100% rename from patches/server/0069-Player-canSee-by-entity-UUID.patch rename to patches/server/0070-Player-canSee-by-entity-UUID.patch diff --git a/patches/server/0070-Spread-out-sending-all-player-info.patch b/patches/server/0071-Spread-out-sending-all-player-info.patch similarity index 100% rename from patches/server/0070-Spread-out-sending-all-player-info.patch rename to patches/server/0071-Spread-out-sending-all-player-info.patch diff --git a/patches/server/0071-Optimize-player-list-for-sending-player-info.patch b/patches/server/0072-Optimize-player-list-for-sending-player-info.patch similarity index 100% rename from patches/server/0071-Optimize-player-list-for-sending-player-info.patch rename to patches/server/0072-Optimize-player-list-for-sending-player-info.patch diff --git a/patches/server/0072-Skip-PlayerCommandSendEvent-if-there-are-no-listener.patch b/patches/server/0073-Skip-PlayerCommandSendEvent-if-there-are-no-listener.patch similarity index 100% rename from patches/server/0072-Skip-PlayerCommandSendEvent-if-there-are-no-listener.patch rename to patches/server/0073-Skip-PlayerCommandSendEvent-if-there-are-no-listener.patch diff --git a/patches/server/0073-Send-multiple-keep-alive-packets.patch b/patches/server/0074-Send-multiple-keep-alive-packets.patch similarity index 100% rename from patches/server/0073-Send-multiple-keep-alive-packets.patch rename to patches/server/0074-Send-multiple-keep-alive-packets.patch diff --git a/patches/server/0074-Specific-interval-TPS-API.patch b/patches/server/0075-Specific-interval-TPS-API.patch similarity index 100% rename from patches/server/0074-Specific-interval-TPS-API.patch rename to patches/server/0075-Specific-interval-TPS-API.patch diff --git a/patches/server/0075-5-second-TPS-average.patch b/patches/server/0076-5-second-TPS-average.patch similarity index 100% rename from patches/server/0075-5-second-TPS-average.patch rename to patches/server/0076-5-second-TPS-average.patch diff --git a/patches/server/0076-Measure-last-tick-time.patch b/patches/server/0077-Measure-last-tick-time.patch similarity index 100% rename from patches/server/0076-Measure-last-tick-time.patch rename to patches/server/0077-Measure-last-tick-time.patch diff --git a/patches/server/0077-Last-tick-time-API.patch b/patches/server/0078-Last-tick-time-API.patch similarity index 100% rename from patches/server/0077-Last-tick-time-API.patch rename to patches/server/0078-Last-tick-time-API.patch diff --git a/patches/server/0078-Show-last-tick-time-in-tps-command.patch b/patches/server/0079-Show-last-tick-time-in-tps-command.patch similarity index 100% rename from patches/server/0078-Show-last-tick-time-in-tps-command.patch rename to patches/server/0079-Show-last-tick-time-in-tps-command.patch diff --git a/patches/server/0079-Collision-physics-check-before-vehicle-check.patch b/patches/server/0080-Collision-physics-check-before-vehicle-check.patch similarity index 100% rename from patches/server/0079-Collision-physics-check-before-vehicle-check.patch rename to patches/server/0080-Collision-physics-check-before-vehicle-check.patch diff --git a/patches/server/0080-Variable-main-thread-task-delay.patch b/patches/server/0081-Variable-main-thread-task-delay.patch similarity index 100% rename from patches/server/0080-Variable-main-thread-task-delay.patch rename to patches/server/0081-Variable-main-thread-task-delay.patch diff --git a/patches/server/0081-Reduce-RandomSource-instances.patch b/patches/server/0082-Reduce-RandomSource-instances.patch similarity index 100% rename from patches/server/0081-Reduce-RandomSource-instances.patch rename to patches/server/0082-Reduce-RandomSource-instances.patch diff --git a/patches/server/0082-CPU-cores-estimation.patch b/patches/server/0083-CPU-cores-estimation.patch similarity index 100% rename from patches/server/0082-CPU-cores-estimation.patch rename to patches/server/0083-CPU-cores-estimation.patch diff --git a/patches/server/0083-Add-centralized-AsyncExecutor.patch b/patches/server/0084-Add-centralized-AsyncExecutor.patch similarity index 100% rename from patches/server/0083-Add-centralized-AsyncExecutor.patch rename to patches/server/0084-Add-centralized-AsyncExecutor.patch diff --git a/patches/server/0084-Remove-Paper-async-executor.patch b/patches/server/0085-Remove-Paper-async-executor.patch similarity index 100% rename from patches/server/0084-Remove-Paper-async-executor.patch rename to patches/server/0085-Remove-Paper-async-executor.patch diff --git a/patches/server/0085-Remove-Paper-cleaner-executor.patch b/patches/server/0086-Remove-Paper-cleaner-executor.patch similarity index 100% rename from patches/server/0085-Remove-Paper-cleaner-executor.patch rename to patches/server/0086-Remove-Paper-cleaner-executor.patch diff --git a/patches/server/0086-Remove-background-executor.patch b/patches/server/0087-Remove-background-executor.patch similarity index 100% rename from patches/server/0086-Remove-background-executor.patch rename to patches/server/0087-Remove-background-executor.patch diff --git a/patches/server/0087-Remove-bootstrap-executor.patch b/patches/server/0088-Remove-bootstrap-executor.patch similarity index 100% rename from patches/server/0087-Remove-bootstrap-executor.patch rename to patches/server/0088-Remove-bootstrap-executor.patch diff --git a/patches/server/0088-Remove-world-upgrade-executors.patch b/patches/server/0089-Remove-world-upgrade-executors.patch similarity index 100% rename from patches/server/0088-Remove-world-upgrade-executors.patch rename to patches/server/0089-Remove-world-upgrade-executors.patch diff --git a/patches/server/0089-Remove-tab-complete-executor.patch b/patches/server/0090-Remove-tab-complete-executor.patch similarity index 100% rename from patches/server/0089-Remove-tab-complete-executor.patch rename to patches/server/0090-Remove-tab-complete-executor.patch diff --git a/patches/server/0090-Remove-text-filter-executor.patch b/patches/server/0091-Remove-text-filter-executor.patch similarity index 100% rename from patches/server/0090-Remove-text-filter-executor.patch rename to patches/server/0091-Remove-text-filter-executor.patch