mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-25 18:09:17 +00:00
[ci skip] benchmark numbers part. 2
This commit is contained in:
@@ -3,6 +3,19 @@ From: Taiyou06 <kaandindar21@gmail.com>
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -3,6 +3,7 @@ From: Taiyou06 <kaandindar21@gmail.com>
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user