-
Notifications
You must be signed in to change notification settings - Fork 571
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
Card: copy getChangedCardTypes #6580
base: master
Are you sure you want to change the base?
Conversation
I'll state for the record that I was using the term "benchmark" loosely; I just slapped together some tests running out of GameSimulationTest that spit out differences in timestamps. Have yet to find a reasonably priced profiler on Linux or set up any sort of clean testing environment. But regardless, I tweaked what I had before to see what happens here. I put 12 copies of Arcane Adaptation into play with different creature types chosen, then used a big creature and Fungal Sprouting to create a bunch of tokens. Then I wrath'd the board. Results:
I don't want to discount random variance as an influence on this takeaway, but I also don't want to spend 20 minutes running the 100 tokens test again and again just to double check. Looks like the impact of this change is at worst negligible and at best a tiny improvement. Maybe stripping out the extra overhead in getType is helping? Could probably tip the scales back and test that theory if I added more Arcane Adaptations and ran it for longer. But either way, whatever sluggishness type-changing causes, I don't think this is a significant impact on it. Caching might be beneficial here, but a proper profiler would be better for determining that. Some other quick tests for reference:
|
@tool4ever do you think we can merge that for now and do more caching later? |
Imo you might just be suppressing the real cause which could just lead to futher problems somewhere else... |
can you just acquire lock in the treemap ie Tables.synchronizedTable(TreeBasedTable.create())? |
@tool4ever do you have a reproduce able case I can test it? And should all Tables in Card be Synced? |
That shouldn't be, but i try it. @tool4ever can you test again, now with |
Uh sorry, I didn't mean it was crashing from your change 😅 |
@kevlahnota your opinion? Should the Tables still be synced? |
hmmm I was under the impression that those are accessed and modified while iteration occurs. Sync can lock but still could produce concurrent modification because the table is not really thread safe. |
Closes #6579
@Jetz72 can you do a Benchmark to test if it doesn't slowdown?
maybe CardState should cache getTypeWithChanges?