Skip to content

Conversation

@vLuckyyy
Copy link
Member

@vLuckyyy vLuckyyy commented Dec 27, 2025

Note

This is mostly a MiniMessages performance issue.

Problem:
Spark profiler showed ticks exceeding 100ms with 150+ players online. The culprit was PlayerQuitMessageController using synchronous Notice#send() instead of Notice#sendAsync(), which blocked the main thread while broadcasting to all online players. JoinMessage already used Notice#sendAsync() for regular joins, but still used Notice#send() for first-time joins, plus it was sending two separate broadcasts per first-time player.

Solution:

  • Changed QuitMessage to use Notice#sendAsync() (same as JoinMessage already did - That's why Spark only showed QuitMessage, not JoinMessage.)
  • Fixed JoinMessage to send only one broadcast instead of two for first-time players
  • Pre-allocated HashSet capacity in BukkitViewerProvider to avoid reallocations when iterating 150+ players

…ead blocking by useless creating ton's of Notices
…QuitMessageController` for consistent code style.
@vLuckyyy vLuckyyy requested a review from a team as a code owner December 27, 2025 15:04
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively addresses the performance issue with quit messages by switching to asynchronous sending. The consolidation of join messages is also a great improvement, reducing redundant broadcasts. My review includes a few suggestions to further enhance code conciseness and maintainability by using more modern Java features like ternary operators and streams. Overall, these are solid improvements to the codebase.

@Jakubk15 Jakubk15 changed the title Fix quit message performance Fix join/quit message performance Dec 27, 2025
@vLuckyyy vLuckyyy changed the title Fix join/quit message performance Fix Quit/Death message performance by building Notice asynchronous. Dec 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants