Latest Posts

Topic: Performance regression

GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2018-02-17, 22:17

The branch that you created when this was last discussed https://code.launchpad.net/~widelands-dev/widelands/ware_routing_speedup


Busy indexing nil values

Top Quote
Tibor

Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2018-02-17, 22:29

I was confused because of the title of bug. I believed the game saving itself is CPU intensive...

As for my branch, this can be enabled via commandline swith or even GUI checkbox as an "experimental" feature. But I am not sure whether anybody will be able by watching the game see that it behaves differently. And for ~99% of wares delivered there should be no difference (the same ware would be picked out by old algorithm).


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2018-02-18, 09:11

I am against a command line switch if we can make this work out of the box. We could switch it on automatically either when the FPS gets low, or if an economy has more than x flags or roads, or for big maps. If we do a dynamic switching, we need to make sure that it's OK for multiplayer too - I don't know if it would affect the sync without having a look. Or if it's really ~90%, let's just have it on always.

ETA: It does affect multiplayer, because it comes from CmdCallEconomyBalance. So, we'd need to parametrize that command if we make it dynamic.

Edited: 2018-02-18, 09:15

Busy indexing nil values

Top Quote
Tibor

Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2018-02-18, 20:51

Well, I would not go this way, just use plain treshold, like 10. If there are less then 10 providers - no difference, if more there might be difference. But it is implemented in the way:

  • sort suppliers by air distance
  • start with nearest (calculate is road distance) - this is winner so far
  • after each winner, try next 3 suppliers.

So if supplier #4 is best (shortest route), it will test also #5, #6, #7. If another winner is found, it will test next 3 suppliers as well.

Unless seafaring is involved there should be no big anomalies. And even if seafaring is involved there must be more suppliers then threshold to even have a chance of a difference.


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2018-02-19, 10:38

OK, let's use a threshold by number of nodes per economy. Maybe weighted by number of players?


Busy indexing nil values

Top Quote
Tibor

Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2018-02-19, 12:11

What nodes do you mean? The beauty of the threshold is that while economy is small, there would be no "cut-offs". So threshold really had to be adjusted to big economies. I would not even consider the number of players, though this is not unreasonable idea...


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2018-02-19, 17:02

I mean nodes = flags in the economy


Busy indexing nil values

Top Quote
PkK

Topic Opener
Joined: 2012-01-06, 12:19
Posts: 236
Ranking
Widelands-Forum-Junkie
Posted at: 2018-02-19, 17:31

Wouldn't using a threshold make maintenance and debugging harder? Why not just use one algorithm (i.e. the one without massive performance issues) all the time?

Philipp


Top Quote
teppo

Joined: 2012-01-30, 09:42
Posts: 423
Ranking
Tribe Member
Posted at: 2018-02-19, 19:11

I recommend testing the new code using the Galaxy map.


Top Quote
kaputtnik
Avatar
Joined: 2013-02-18, 20:48
Posts: 2434
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2018-02-19, 20:19

teppo wrote:

I recommend testing the new code using the Galaxy map.

+1

Good candidates for testing are also:


Fight simulator for Widelands:
https://wide-fighter.netlify.app/

Top Quote