From 472a1c5c19a6445591acaaf5895ca35efb7bef71 Mon Sep 17 00:00:00 2001 From: Taiyou06 Date: Sun, 16 Mar 2025 22:04:12 +0100 Subject: [PATCH] [ci skip] benchmark numbers part. 2 --- .../0124-Slightly-optimise-getNearestPlayer.patch | 13 +++++++++++++ ...se-the-pre-filtered-ticking-chunks-list-as.patch | 1 + .../features/0130-Optimize-AABB.patch | 1 + 3 files changed, 15 insertions(+) diff --git a/leaf-server/minecraft-patches/features/0124-Slightly-optimise-getNearestPlayer.patch b/leaf-server/minecraft-patches/features/0124-Slightly-optimise-getNearestPlayer.patch index 9fb38c3c..3e80b556 100644 --- a/leaf-server/minecraft-patches/features/0124-Slightly-optimise-getNearestPlayer.patch +++ b/leaf-server/minecraft-patches/features/0124-Slightly-optimise-getNearestPlayer.patch @@ -3,6 +3,19 @@ From: Taiyou06 Date: Sun, 16 Feb 2025 09:21:50 +0100 Subject: [PATCH] Slightly optimise getNearestPlayer +Original: + +Condition checks per iteration: ~3-4 (predicate check, distance check, and d comparison) +Calculations per iteration: Distance calculation + potentially a multiplication +Total operations: ~(5-6) × n + +Patch: + +Condition checks per iteration: 1 (just the distance comparison) +Calculations per iteration: Distance calculation +One-time operation: Convert distance to squared distance +Total operations: ~3 × n (in the no-predicate case) or ~4 × n (with predicate) + diff --git a/net/minecraft/world/level/EntityGetter.java b/net/minecraft/world/level/EntityGetter.java index 670860df81a3abfc1b8b53be505fce0ee32ee2c4..083a2b5da246113913bcd5d0b2b9be42cf0554d9 100644 diff --git a/leaf-server/minecraft-patches/features/0128-Directly-use-the-pre-filtered-ticking-chunks-list-as.patch b/leaf-server/minecraft-patches/features/0128-Directly-use-the-pre-filtered-ticking-chunks-list-as.patch index 7dbac5ad..792385ff 100644 --- a/leaf-server/minecraft-patches/features/0128-Directly-use-the-pre-filtered-ticking-chunks-list-as.patch +++ b/leaf-server/minecraft-patches/features/0128-Directly-use-the-pre-filtered-ticking-chunks-list-as.patch @@ -4,6 +4,7 @@ Date: Sun, 16 Feb 2025 01:13:04 +0100 Subject: [PATCH] Directly use the pre-filtered ticking chunks list as the output +This patch uses already pre filtered chunks, which completely skips the isChunkNearPlayer check diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java index c80464d333bd37a9b8bc7cea2291c8c72e6f9bd6..b1f1b596a597d559aa672a3cb46a03917ad746af 100644 diff --git a/leaf-server/minecraft-patches/features/0130-Optimize-AABB.patch b/leaf-server/minecraft-patches/features/0130-Optimize-AABB.patch index 2c85ef77..cfc2bc58 100644 --- a/leaf-server/minecraft-patches/features/0130-Optimize-AABB.patch +++ b/leaf-server/minecraft-patches/features/0130-Optimize-AABB.patch @@ -3,6 +3,7 @@ From: Taiyou06 Date: Sun, 16 Feb 2025 19:03:23 +0100 Subject: [PATCH] Optimize AABB +Pretty minor stuff but, it improves AABB.intersect by around ~5% diff --git a/net/minecraft/world/phys/AABB.java b/net/minecraft/world/phys/AABB.java index f64c04b32dd2d0fe143fc8bf9f498e52beb66a58..00daaff66bd26e9ca15a7eb4052ff38f9e662f7b 100644