-
Notifications
You must be signed in to change notification settings - Fork 795
Proposition: Put some expensive queries into cache #8916
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
base: master
Are you sure you want to change the base?
Conversation
|
Calculate Amount needs some refactoring anyway because right now you need to do "put into cache" at multiple locations Might refactor it into a Supplier with |
| } | ||
|
|
||
| protected void onChanged() { | ||
| game.resetCache(); |
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.
I don't think this will work
while zone change is one of the more common ways for the board state to change there are just too many others, e.g. using Orcish Farmer (though technically we might see this one because it already uses effect card)
by the time you're done hooking this up to all possible places I'd expect you end up with way more than 100 calls
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.
I believe that tapping does trigger a change as well.
EDIT: Now it does.
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.
how...?
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.
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.
hmn I see
so reset will happen every mainLoopStep at least
There are some instances you don't want to cache (like the random one) so that's why it is targeted ATM. I could add a utility function to prevent some code repeat. |
|
While looking at #8842 i noticed, that Player Properties can't be chained endlessly in xCount it really didn't like this, what i tried: Also for another issue, we need to think about how stuff like |
|
As it is right now, it mostly helps with decks with multiple cards that checks for the same values, or have copies of itself (such as Relentless Rats decks). But I do see multiple cache hits when playing a single copy of Wight of Precinct Six. I thought about invalidating cache values depending on the updated zone(s), but I'm not sure about the added complexity. |
|
your assumption of same string = same value is on shaky ground :P |
I don't think it'll matter for spells as they'll trigger cache reset when the stack gets changed. But I see your point that remembered player can be different. I'll see if I can do anything about it. |
|
This PR has not been updated in a while nad has been marked on stale. Stale PRs will be auto closed |

I've played against the Nightmare deck, and it was very laggy as it tried to count its Swamps over and over again. This should alleviate the problem by caching some expensive queries, which are cleared every time the zones are changed. Even if it happens often, it will still only calculate it once per reset rather than 3-4 times.
What do you think?