Skip to content

feat: remove name field in Event class - #14198

Merged
kennytv merged 1 commit into
PaperMC:mainfrom
Strokkur424:feat/remove-event-name-field
Aug 20, 2026
Merged

feat: remove name field in Event class#14198
kennytv merged 1 commit into
PaperMC:mainfrom
Strokkur424:feat/remove-event-name-field

Conversation

@Strokkur424

Copy link
Copy Markdown
Member

Initially discovered by @SirYwell, the Event class currently holds a String name field that is only used to cache the output of getClass().getSimpleName().

However, that getSimpleName() method itself is already cached as part of the class' reflection data, making this manual cache mostly a waste of 4/8 bytes of memory.

Additionally, in server code, the getEventName() method is only called once in error messages, and thus the cache may not even live to see any effect.

For a class as frequently constructed, the memory save here can be seen as significant.

@Strokkur424
Strokkur424 requested a review from a team as a code owner August 19, 2026 18:03
@github-project-automation github-project-automation Bot moved this to Awaiting review in Paper PR Queue Aug 19, 2026
@papermc-projects papermc-projects Bot moved this from Awaiting review to Delayed approval in Paper PR Queue Aug 20, 2026

@electronicboy electronicboy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

muh bytes

@papermc-projects papermc-projects Bot moved this from Delayed approval to Full approval in Paper PR Queue Aug 20, 2026
@kennytv
kennytv merged commit 0bdc80d into PaperMC:main Aug 20, 2026
9 checks passed
@github-project-automation github-project-automation Bot moved this from Full approval to Merged in Paper PR Queue Aug 20, 2026
@Strokkur424
Strokkur424 deleted the feat/remove-event-name-field branch August 20, 2026 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Merged

Development

Successfully merging this pull request may close these issues.

5 participants