Performance problem with savegame

Bug #1749653 reported by GunChleoc
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
widelands
Won't Fix
Undecided
Unassigned

Bug Description

Reported on the forum: https://wl.widelands.org/forum/topic/4207/?page=1#post-24078

The first savegame is OK with MAC OS on a MacBook Pro (2014) I7 Quadcore Haswell, taking up 50% CPU. The second one will stutter, using 100% CPU.

Hopefully somebody has a machine that is fast enough for profiling this.

Revision history for this message
GunChleoc (gunchleoc) wrote :
Revision history for this message
GunChleoc (gunchleoc) wrote :

Here's the slow savegame

description: updated
Revision history for this message
GunChleoc (gunchleoc) wrote :

I'm now having a problem with the attached savegame, which I used to be able to load without problems.

@Tepo, could you please check if this is related to the recent scout improvements? That's the biggest saveloading change that I remember.

Changed in widelands:
assignee: nobody → Teppo Mäenpää (kxq)
Revision history for this message
Teppo Mäenpää (kxq) wrote :

@GunChleoc:

The savegame of yours loads fine on my computer.

I see a problem with the Dillinger savegames: The "before" is on the fringe of playability (on my PC, which is slow); "after" is a lot worse: Even mouse moves only every few seconds.

If I let the "before" savegame run for some minutes, it becomes unresponsive too.

I definitely cannot profile those. What is the problem with Eiskriege_57? Appears fine using trunk, on Debian 9.

Since the "Dillinger before" initially loads fine and suddenly becomes problematic, I think that it is not very likely that the problem would be related to save format change. Actually, I think that if Dillinger being heavy is a result of mine, the forester change would be a more likely cause.

In short: No, I cannot profile those. Could not see obvious problems with Eiskriege.

Revision history for this message
GunChleoc (gunchleoc) wrote :

Thanks for testing! I'll unassign you then.

The problem with Eiskriege was that is just kept loading and loading... my machine isn't very fast, but I have used it as a nice big est map in the past.

I also can't run Valgrind or anything, it would be interesting to see if we can get some illumination out of that.

Changed in widelands:
assignee: Teppo Mäenpää (kxq) → nobody
Revision history for this message
kaputtnik (franku) wrote :

Eiskriege is a really big map. Some time ago Tibor has made a branch which speeds up ware routing. This is this branch https://code.launchpad.net/~widelands-dev/widelands/ware_routing_speedup

Maybe some one could test the save game with that branch? (don't know if it would load)

See also: https://wl.widelands.org/forum/topic/2925/?page=2

Revision history for this message
GunChleoc (gunchleoc) wrote :

Seems like my system was exceptionally slow, I can now load Ice Wars again and also the attached savegames. The second one is indeed slower than the first one. I'll try the ware routing speedup branch to see if it makes a difference - it will be immediately apparent on my old machine :)

Revision history for this message
John Dillinger (dillinger76) wrote :

Do you guys think the "being slow" problem with my game is a bug or just a problem of the performance of my machine?

I was wondering why the CPU load changed from about 50% up to 100% round about 5 minutes later.

@gunchleoc: I'm not experienced with this forum but as I have understood from Teppo this problem should be assigned to another developer for a further analysis?

Thanks for your help. I like this game a lot and it would be pretty sad if I could not continue my game. :-/

Revision history for this message
GunChleoc (gunchleoc) wrote :

Unless we want to call somebody's attention to a bug, we usually don't assign anybody, because everybody is a volunteer. It's up to the volunteers to snap up the bugs that they want to fix. We use milestones to make sure that nothing important gets forgotten.

I guess the reason the CPU usage went up was some change in your road layout?

A faster computer always helps, but if we can make this work on slower computer, even better!

Revision history for this message
John Dillinger (dillinger76) wrote :

Thanks for your reply and sorry if I sounded too demanding. And also thanks for that hint with the road layout. I will try to modify that ...

Best regards

Revision history for this message
GunChleoc (gunchleoc) wrote :

Don't worry, you weren't too demanding. Your tone is polite enough and you had a legitimate question :)

Revision history for this message
Teppo Mäenpää (kxq) wrote :

I made some attempt to run this over callgrind. The result was that about 60% of the time was in think(), about 30% in replaywriter and the rest was not clear story. The replaywriter was a bit of a surprise, since the game barely progressed.

Is the frequency of think() still tied to wallclock time or game time progress? The wallclock time way harms profiling on older computers quite badly.

Revision history for this message
GunChleoc (gunchleoc) wrote :

https://code.launchpad.net/~widelands-dev/widelands/ware_routing_speedup makes a big difference with a release build on my system

Revision history for this message
Teppo Mäenpää (kxq) wrote :

I messed up above: forgot that there are think() routines in many places, not just in AI. Should not write to LP when there is not time to think() self first.

Revision history for this message
GunChleoc (gunchleoc) wrote :

We have discussed om the forum, that we will skip some ware routing calculations when an economy has more than X flags.

Changed in widelands:
status: New → Confirmed
tags: added: economy
Revision history for this message
GunChleoc (gunchleoc) wrote :

I have linked a new branch https://code.launchpad.net/~widelands-dev/widelands/ware_routing_fps that we can use to measure which threshold we should have.

Revision history for this message
GunChleoc (gunchleoc) wrote :

I have attached some test results.

I let Widelands run until it found Both current FPS + Average FPS < 20.0 10x in a row, then wrote the number of flags in each economy and triggered a crash to save myself from digging through long logs.

With just 1 AI running in release mode, I couldn't crash it at 1x speed, but I could on some maps with higher speeds.

Having multiple AI players running instead of just 1 does seem to be a factor. How about we just have a common cutoff anyway, to keep things simple? I'm thinking 500 flags.

The peak values are:

Debug build without ASan
========================

574 flags: seafaring, 8 AIs
486 flags: no seafaring, 1 AI
478 flags: seafaring, 1 AI

Release build, 4x speed
=======================

559 flags: seafaring, 8 AIs
1015 flags: no seafaring, 1 AI
limit not reached: seafaring, 1 AI

Release build, 2x speed
=======================

548 flags: seafaring, 8 AIs
1016 flags: no seafaring, 1 AI
limit not reached: seafaring, 1 AI

Release build, 1x speed
=======================

676 flags: seafaring, 8 AIs
limit not reached: no seafaring, 1 AI
limit not reached: seafaring, 1 AI

GunChleoc (gunchleoc)
Changed in widelands:
status: Confirmed → In Progress
assignee: nobody → GunChleoc (gunchleoc)
GunChleoc (gunchleoc)
Changed in widelands:
status: In Progress → Confirmed
assignee: GunChleoc (gunchleoc) → nobody
milestone: build20-rc1 → build21-rc1
Revision history for this message
GunChleoc (gunchleoc) wrote :
Changed in widelands:
status: Confirmed → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.