generated from runelite/example-plugin
-
-
Notifications
You must be signed in to change notification settings - Fork 418
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
ItemRequirement rework #1847
Merged
Merged
ItemRequirement rework #1847
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This attempts to add a level of caching to ItemRequirement, so that it doesn't regularly need to go deeper into checks when it already knows the answer.
pajlada
reviewed
Nov 21, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small nits
src/main/java/com/questhelper/requirements/item/ContainerState.java
Outdated
Show resolved
Hide resolved
Co-Authored-By: pajlada <962989+pajlada@users.noreply.github.com>
Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
Co-Authored-By: pajlada <962989+pajlada@users.noreply.github.com>
Co-Authored-By: pajlada <962989+pajlada@users.noreply.github.com>
Co-Authored-By: pajlada <962989+pajlada@users.noreply.github.com>
Co-Authored-By: pajlada <962989+pajlada@users.noreply.github.com>
Co-Authored-By: pajlada <962989+pajlada@users.noreply.github.com>
Co-Authored-By: pajlada <962989+pajlada@users.noreply.github.com>
Co-Authored-By: pajlada <962989+pajlada@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR intends to improve the efficiency of ItemRequirement checks by including some caching where possible. I've tried to introduce the concept of cached containers (inventory, equipped, bank), which I hope will in the future make it easier for us to include new container concepts such as the rune pouch, POH storage, etc.
I've checked how long the checks take for the sidebar each tick for the Check all items helpers as it's the largest in terms of requirements. Generally across 1000 ticks the new method while cached is 2x faster on average. I've included a 100s sample below with in the cache, with the average for it being:
newDiff.txt
oldDiff.txt
We're not dealing with massive values in general, though I've also not encountered the lag spikes on my computer, so I'm going on the assumption for lower spec devices this will hopefully make a bigger difference.
I need to still add in some better comments and preferably some tests for this going forwards.