Important Dates

Currently Online

Latest Posts

Topic: Performance regression

PkK
Joined: 2012-01-06, 12:19
Posts: 188
Ranking
Widelands-Forum-Junkie
Posted at: 2017-10-07, 21:51

I am using current widelands from bzr. On a Debian GNU/Linux system with a i7-7500U.

A few days ago, I started a game on the Lesser Ring 1.1 map. Nearly 7 hours of game time have passed, and the game has become unplayably slow, with average fps in the single-digit range.

When I played on the same map on the same system at the end of June, widelands performance was much better, and the game was playable on the same map for much longer.

Of course, my system's software got updated since then, so the regression might be causes by drivers or the kernel. But I did not notice performance regression in other software, so I suspect it is a regression in widelands.

Philipp


Top Quote
Tibor
Joined: 2009-03-23, 23:24
Posts: 1317
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-10-07, 22:31

Does the performance regression happens also after loading a saved game? Maybe if you provided a savegame I could run some profiling tool and try to figure out what might be going on... I used to do it some time ago...


Top Quote
PkK
Joined: 2012-01-06, 12:19
Posts: 188
Ranking
Widelands-Forum-Junkie
Posted at: 2017-10-07, 22:48

I just did a quick test:

1) When loading a savegame started in current widelands, the performane is bad.

2) Whenloading a savgegame started a few month ago, in current widelands, the performance seems no worse than what it used to be.

Philipp


Top Quote
PkK
Joined: 2012-01-06, 12:19
Posts: 188
Ranking
Widelands-Forum-Junkie
Posted at: 2017-10-07, 22:53

Here are the two savegames:

http://colecovision.eu/stuff/widelands-performance-regression/

PkK 2, started a few days ago has bad performance after nearly 7 hours of game-time.

PkK 3, started a few months ago has acceptable performance after nearly 10 hours of game-time.

I loaded both in widelands revno 8461.

Philipp


Top Quote
Tibor
Joined: 2009-03-23, 23:24
Posts: 1317
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-10-07, 23:17

It is strange. So the problem is not the code but something in the map? More bobs/workers/soldiers perhaps? These tend to be quite CPU intensive. I will look at the savegame, but first I must remember how I did profile it before ...


Top Quote
PkK
Joined: 2012-01-06, 12:19
Posts: 188
Ranking
Widelands-Forum-Junkie
Posted at: 2017-10-08, 09:27

Could this be be related to the changes in the AI?

Philipp


Top Quote
Tibor
Joined: 2009-03-23, 23:24
Posts: 1317
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-10-08, 18:55

PkK wrote:

Could this be be related to the changes in the AI?

Philipp

Probably not


Top Quote
Tibor
Joined: 2009-03-23, 23:24
Posts: 1317
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-10-08, 21:33

I was not successful so far. There is some issue with gprof and latest gcc. gmon.out is generated, but gprof after some 15 minutes produces empty file only with headers and some introductory text. The issue is known and discussed, they suggest to downgrade to gcc 4.9 that is huge step backward so basically impossible. Suggested flag --no-pie did not help either...

I will look after other possibilities...


Top Quote
Tibor
Joined: 2009-03-23, 23:24
Posts: 1317
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-10-08, 22:18

I opened both games alongside and indeed PkK2 is much slower.

We can compile month-old revision and did the same test. If the savegame compatibility was not broken in the meantime...


Top Quote
Tibor
Joined: 2009-03-23, 23:24
Posts: 1317
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-10-08, 23:12
So I managed to get some output from callgrind, the game speed should be 0.05x, and numbers looks like:

Ir | sysCount | sysTime | file:function
21,364,829,668 56,593 160 PROGRAM TOTALS
21,364,516,945 56,617 160 trunk/src/ui_basic/panel.cc:UI::Panel::do_run()
6,123,666,151 35,994 120 /var/widelands2/BZR/trunk/src/graphic/graphic.cc:Graphic::refresh()
6,123,666,151 35,994 120 trunk/src/graphic/graphic.cc:Graphic::refresh()
6,118,218,529 25,183 84 /var/widelands2/BZR/trunk/src/graphic/render_queue.cc:RenderQueue::draw(int, int)
6,118,218,529 25,183 84 trunk/src/graphic/render_queue.cc:RenderQueue::draw(int, int)
5,586,116,377 23,941 80 trunk/src/graphic/render_queue.cc:RenderQueue::draw_items(std::vector<RenderQueue::Item, std::allocator<RenderQueue::Item> > const&)
721,786,393 7,853 32 /var/widelands2/BZR/trunk/src/graphic/gl/blit_program.cc:BlitProgram::draw(std::vector<BlitProgram::Arguments, std::allocator<BlitProgram::Arguments> > const&)
26,525,586,151 21,527 22 trunk/src/ui_basic/panel.cc:UI::Panel::do_think()'2
286,532,935 7,679 21 /var/widelands2/BZR/trunk/src/graphic/gl/fill_rect_program.cc:FillRectProgram::draw(std::vector<FillRectProgram::Arguments, std::allocator<FillRectProgram::Arguments> > const&)
286,532,935 7,679 21 trunk/src/graphic/gl/fill_rect_program.cc:FillRectProgram::draw(std::vector<FillRectProgram::Arguments, std::allocator<FillRectProgram::Arguments> > const&)
12,215,814,398 10,355 20 trunk/src/ui_basic/panel.cc:UI::Panel::do_think()
12,215,256,521 10,355 20 /var/widelands2/BZR/trunk/src/wui/interactive_player.cc:InteractivePlayer::think()
12,215,256,521 10,355 20 trunk/src/wui/interactive_player.cc:InteractivePlayer::think()
12,212,406,825 10,352 20 /var/widelands2/BZR/trunk/src/wui/interactive_base.cc:InteractiveBase::think()
12,212,406,825 10,352 20 trunk/src/wui/interactive_base.cc:InteractiveBase::think()
12,211,910,004 10,352 20 /var/widelands2/BZR/trunk/src/logic/game.cc:Widelands::Game::think()
12,211,910,004 10,352 20 trunk/src/logic/game.cc:Widelands::Game::think()
15,318,167,929 9,870 19 ???:mcount
12,205,681,326 9,843 18 /var/widelands2/BZR/trunk/src/logic/cmd_queue.cc:Widelands::CmdQueue::run_queue(int, unsigned int&)
12,205,681,326 9,843 18 trunk/src/logic/cmd_queue.cc:Widelands::CmdQueue::run_queue(int, unsigned int&)
11,810,502,949 9,522 17 /var/widelands2/BZR/trunk/src/economy/router.cc:Widelands::Router::find_route(Widelands::RoutingNode&, Widelands::RoutingNode&, Widelands::IRoute*, Widelands::WareWorker, int, Widelands::ITransportCostCalculator&)
11,810,502,949 9,522 17 trunk/src/economy/router.cc:Widelands::Router::find_route(Widelands::RoutingNode&, Widelands::RoutingNode&, Widelands::IRoute*, Widelands::WareWorker, int, Widelands::ITransportCostCalculator&)
11,763,649,591 9,479 17 /var/widelands2/BZR/trunk/src/economy/routeastar.h:Widelands::RouteAStar<Widelands::AStarEstimator>::step()
11,763,649,591 9,479 17 trunk/src/economy/routeastar.h:Widelands::RouteAStar<Widelands::AStarEstimator>::step()
11,743,942,927 9,469 17 /var/widelands2/BZR/trunk/src/economy/cmd_call_economy_balance.cc:Widelands::CmdCallEconomyBalance::execute(Widelands::Game&)
11,743,942,927 9,469 17 trunk/src/economy/cmd_call_economy_balance.cc:Widelands::CmdCallEconomyBalance::execute(Widelands::Game&)
11,743,318,573 9,469 17 /var/widelands2/BZR/trunk/src/economy/economy.cc:Widelands::Economy::balance(unsigned int)
11,743,318,573 9,469 17 trunk/src/economy/economy.cc:Widelands::Economy::balance(unsigned int)
11,687,918,718 9,424 17 trunk/src/economy/economy.cc:Widelands::Economy::balance_requestsupply(Widelands::Game&)
11,679,728,821 9,416 17 trunk/src/economy/economy.cc:Widelands::Economy::process_requests(Widelands::Game&, Widelands::RSPairStruct*)
11,672,999,501 9,415 17 trunk/src/economy/economy.cc:Widelands::Economy::find_best_supply(Widelands::Game&, Widelands::Request const&, int&)
11,564,501,758 9,320 17 trunk/src/economy/economy.cc:Widelands::Economy::find_route(Widelands::Flag&, Widelands::Flag&, Widelands::Route*, Widelands::WareWorker, int)
2,156,059,853 4,041 16 /var/widelands2/BZR/trunk/src/graphic/gl/terrain_program.cc:TerrainProgram::draw(unsigned int, DescriptionMaintainer<Widelands::TerrainDescription> const&, FieldsToDraw const&, float)
2,156,059,853 4,041 16 trunk/src/graphic/gl/terrain_program.cc:TerrainProgram::draw(unsigned int, DescriptionMaintainer<Widelands::TerrainDescription> const&, FieldsToDraw const&, float)
8,929,827,938 5,012 11 ???:__mcount_internal
6,889,871,904 5,583 11 trunk/src/logic/cookie_priority_queue.h:CookiePriorityQueue<Widelands::RoutingNode, Widelands::RoutingNode::LessCost, DefaultCookieAccessor<Widelands::RoutingNode> >::selftest()
5,987,431,482 4,935 9 /var/widelands2/BZR/trunk/src/logic/cookie_priority_queue.h:CookiePriorityQueue<Widelands::RoutingNode, Widelands::RoutingNode::LessCost, DefaultCookieAccessor<Widelands::RoutingNode> >::pop(Widelands::RoutingNode*)
5,987,431,482 4,935 9 trunk/src/logic/cookie_priority_queue.h:CookiePriorityQueue<Widelands::RoutingNode, Widelands::RoutingNode::LessCost, DefaultCookieAccessor<Widelands::RoutingNode> >::pop(Widelands::RoutingNode*)
3,016,231,409 7,261 9 trunk/src/ui_basic/panel.cc:UI::Panel::do_draw(RenderTarget&)
3,015,196,659 7,259 9 trunk/src/ui_basic/panel.cc:UI::Panel::do_draw_inner(RenderTarget&)
4,637,932,099 3,707 8 trunk/src/economy/routeastar.h:Widelands::RouteAStar<Widelands::AStarEstimator>::push(Widelands::RoutingNode&, int, Widelands::RoutingNode*)
2,089,333,038 2,956 8 /var/widelands2/BZR/trunk/src/graphic/gl/dither_program.cc:DitherProgram::draw(unsigned int, DescriptionMaintainer<Widelands::TerrainDescription> const&, FieldsToDraw const&, float)
2,089,333,038 2,956 8 trunk/src/graphic/gl/dither_program.cc:DitherProgram::draw(unsigned int, DescriptionMaintainer<Widelands::TerrainDescription> const&, FieldsToDraw const&, float)
5,251,032,772 4,312 7 trunk/src/logic/cookie_priority_queue.h:CookiePriorityQueue<Widelands::RoutingNode, Widelands::RoutingNode::LessCost, DefaultCookieAccessor<Widelands::RoutingNode> >::increase_key(Widelands::RoutingNode*)
999,508,439 4,812 6 /var/widelands2/BZR/trunk/src/graphic/font_handler1.cc:UI::FontHandler1::render(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned short)
999,508,439 4,812 6 trunk/src/graphic/font_handler1.cc:UI::FontHandler1::render(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned short)
4,300,873,534 3,423 6 /var/widelands2/BZR/trunk/src/logic/cookie_priority_queue.h:CookiePriorityQueue<Widelands::RoutingNode, Widelands::RoutingNode::LessCost, DefaultCookieAccessor<Widelands::RoutingNode> >::push(Widelands::RoutingNode*)
4,300,873,534 3,423 6 trunk/src/logic/cookie_priority_queue.h:CookiePriorityQueue<Widelands::RoutingNode, Widelands::RoutingNode::LessCost, DefaultCookieAccessor<Widelands::RoutingNode> >::push(Widelands::RoutingNode*)
4,055,027,552 3,221 5 trunk/src/logic/cookie_priority_queue.h:CookiePriorityQueue<Widelands::RoutingNode, Widelands::RoutingNode::LessCost, DefaultCookieAccessor<Widelands::RoutingNode> >::decrease_key(Widelands::RoutingNode*)
1,182,587,844 4,482 5 /var/widelands2/BZR/trunk/src/wui/interactive_gamebase.cc:InteractiveGameBase::draw_overlay(RenderTarget&)
1,182,587,844 4,482 5 trunk/src/wui/interactive_gamebase.cc:InteractiveGameBase::draw_overlay(RenderTarget&)
1,136,610,720 4,188 5 /var/widelands2/BZR/trunk/src/wui/interactive_base.cc:InteractiveBase::draw_overlay(RenderTarget&)

This was for very short time period, perhaps 2 seconds of gametime. Can somebody interpret this? It seems to me thad drawing is biggest consumer of CPU...
Top Quote