Conversation
Replaced O(N*M) loop checking all online players with an O(M) loop that directly looks up guild members via `Bukkit.getPlayerExact()`. Co-authored-by: acsoto <59144459+acsoto@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
💡 What: Replaced the O(N*M) loop checking all online players with an O(M) loop that directly iterates over the guild member list and uses
Bukkit.getPlayerExact()to retrieve the player objects in constant time.🎯 Why: When a non-chairman logs in, the
LoginListeneriterated over the entire list ofBukkit.getOnlinePlayers()(O(N)), and fetched the guild member list for every single player to do a string.contains()check (O(M)). As player count increases, this creates significant main-thread latency during logins.📊 Impact: Reduces time complexity from O(N * M) to O(M), significantly decreasing main-thread load on high-population servers. Also prevents redundant
getGuildMembers()cache queries.🔬 Measurement: A server profiler (like spark/timings) would show reduced cpu usage for
LoginListener.onAuthduring login events when player counts scale. Ensure login functionality correctly broadcasts to guild members only.PR created automatically by Jules for task 15211424017188027604 started by @acsoto