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

Optimize SlimefunUtils#isItemSimilar / Optimize SlimefunUtils#equalsItemMeta #4135

Closed
wants to merge 1 commit into from

Conversation

IAISI
Copy link

@IAISI IAISI commented Feb 19, 2024

Optimize SlimefunUtils#isItemSimilar
Optimize SlimefunUtils#equalsItemMeta

Description

We can skip some of slow ItemMeta checks that relay on getDisplayName() and getLore() which both deserialize string from JSON internally in Spigot

Proposed changes

We check SF Item IDs first if those are available and then fallback to ItemMeta check.

Related Issues (if applicable)

Checklist

  • I have fully tested the proposed changes and promise that they will not break everything into chaos.
  • I have also tested the proposed changes in combination with various popular addons and can confirm my changes do not break them.
  • I have made sure that the proposed changes do not break compatibility across the supported Minecraft versions (1.16.* - 1.20.*).
  • I followed the existing code standards and didn't mess up the formatting.
  • I did my best to add documentation to any public classes or methods I added.
  • I have added Nonnull and Nullable annotations to my methods to indicate their behaviour for null values
  • I added sufficient Unit Tests to cover my code.

Optimize SlimefunUtils#equalsItemMeta

We can skip some of slow ItemMeta checks that relay on getDisplayName() and getLore() which both deserialize string from JSON internally in Spigot
@IAISI IAISI requested a review from a team as a code owner February 19, 2024 12:01
Copy link
Contributor

Pro Tip!
You can help us label your Pull Requests by using the following branch naming convention next time you create a pull request. ❤️

Branch naming convention Label
feature/** 🎈 Feature
fix/** ✨ Fix
chore/** 🧹 Chores
api/** 🔧 API
performance/** 💡 Performance Optimization
compatibility/** 🤝 Compatibility

If your changes do not fall into any of these categories, don't worry. You can just ignore this message in that case! 👀

@J3fftw1
Copy link
Contributor

J3fftw1 commented Feb 19, 2024

We have another PR changing this already as said many times on discord.
#4120

@IAISI
Copy link
Author

IAISI commented Feb 19, 2024

The #4120 doesn't remove those functions from SlimeFunUtils class tho? If so it's possible they would still be used? By other addons and stuff that is not related to Cargo?

@WalshyDev
Copy link
Member

We cannot just remove public API without a deprecation period. The PR deprecates them as is our policy. That PR changes all Slimefun usages of the functions including Cargo.

They will be removed after the next RC when it's merged.

@IAISI
Copy link
Author

IAISI commented Feb 19, 2024

Sounds good, I guess I can just close this?

@J3fftw1
Copy link
Contributor

J3fftw1 commented Feb 19, 2024

Closed in favour of #4120

@J3fftw1 J3fftw1 closed this Feb 19, 2024
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.

4 participants