GUI slowdowns
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
2 posts
• Page 1 of 1
GUI slowdowns
by Max mtg » 02 Aug 2012, 21:55
Investigating further game slowndowns I have come across mutiple repainting of PlayArea.
To see that, consider placing this code at the beginning of forge.view.arcane.PlayArea.wrap(CardStackRow, List<CardStackRow>, int)
I also ran profiler to play a number of turns in a match - there were some 146k calls to wrap(...), that summed up took 5 seconds.
There should not be that many repaints. Who knows what causes them?
To see that, consider placing this code at the beginning of forge.view.arcane.PlayArea.wrap(CardStackRow, List<CardStackRow>, int)
- Code: Select all
private int cntRepaints = 0;
private int wrap(final CardStackRow sourceRow, final List<CardStackRow> rows, final int insertIndex) {
// The cards are sure to fit (with vertical scrolling) at the minimum
// card width.
final boolean allowHeightOverflow = this.cardWidth == this.getCardWidthMin();
System.err.format("[%d] @ %d - Repaint playarea%n", new Date().getTime(), cntRepaints++);
I also ran profiler to play a number of turns in a match - there were some 146k calls to wrap(...), that summed up took 5 seconds.
There should not be that many repaints. Who knows what causes them?
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
Re: GUI slowdowns
by Max mtg » 03 Aug 2012, 22:44
What I've learnt - doLayout of playarea iterates from maxCardWith till 50 until it finds a value when cards fit into playarea size. Each iteration include arraylist creation and other kind of collection management.
I have changed some code so that the costly method wrap is called 20 times less often. Expect low-end PCs to benefit from this change.
I have changed some code so that the costly method wrap is called 20 times less often. Expect low-end PCs to benefit from this change.
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 41 guests