You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: common/src/main/kotlin/com/lambda/util/world/EntityUtils.kt
+9-2Lines changed: 9 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -22,10 +22,17 @@ object EntityUtils {
22
22
range:Double = 6.0,
23
23
noinline predicate: (T) ->Boolean = { true },
24
24
): T? {
25
-
26
25
// Speculative execution trolling
27
26
val entities =
28
27
if (range >64) getEntities(predicate)
28
+
// I have an idea for optimization.
29
+
//
30
+
// Since the search operates linearly, eventually it will reach the midpoint.
31
+
// Calculate the distance between the first and last entities.
32
+
// Obtain the delta value.
33
+
// Theoretically, the closest entity should be within a cubic space of delta^3 blocks.
34
+
// If there are no entities within this delta box, examine the outer box. (Although this is unlikely given the fact that the closest entity is within the delta box.)
35
+
// The performance improvement is relative to the initial state.
0 commit comments