Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimised ItemDecorationHandler for the default case #1482

Open
wants to merge 1 commit into
base: 1.21.x
Choose a base branch
from

Conversation

HenryLoenwind
Copy link
Contributor

In 99+% of cases, there is no registered IItemDecorator, so shaving off a couple of ns when rendering a GUI ItemStack makes sense in my opinion. Especially when it can be done so cheaply.

BTW: Carrying around a GlStateBackup for each item with a decorator instead of a ThreadLocal one seems overkill and wasteful, but it probably is inconsequential given the low number of items with decorators. Unless there are mods that decorate all items? Then it'd be worth changing. (But in that case, a way to register one decorator for all items would be even more sensible.)

@neoforged-pr-publishing
Copy link

  • Publish PR to GitHub Packages

@Technici4n
Copy link
Member

Can I see a before/after profile? ;)

@HenryLoenwind
Copy link
Contributor Author

Can I see a before/after profile? ;)

I can set something up, but not today (11pm).

@embeddedt
Copy link
Member

Couldn't this whole change be simplified to adding if (itemDecorators.isEmpty()) return; at the head of render? Much simpler than unfinalizing the class and adding an anonymous class, and should be just as fast. IMO that change could be merged even without profiling; it clearly makes sense.

@Technici4n
Copy link
Member

Couldn't this whole change be simplified to adding if (itemDecorators.isEmpty()) return; at the head of render? Much simpler than unfinalizing the class and adding an anonymous class, and should be just as fast. IMO that change could be merged even without profiling; it clearly makes sense.

True. That is fine to do without a profile yeah. (But nonetheless I would like to know... is there any visible effect in any profile?)

@sciwhiz12
Copy link
Member

This PR has Spotless violations. Please run spotlessApply to fix them.

@sciwhiz12 sciwhiz12 added enhancement New (or improvement to existing) feature or request performance Related to performance 1.21.1 Targeted at Minecraft 1.21.1 labels Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.21.1 Targeted at Minecraft 1.21.1 enhancement New (or improvement to existing) feature or request performance Related to performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants