Cataclysm-dda: Performance hit since build 6631

Created on 30 Jul 2017  路  4Comments  路  Source: CleverRaven/Cataclysm-DDA

The game runs flawlessly with build 6630.

When I upgrade to 6631 it becomes really sluggish (taking several ms to step from one tile to another). I tested it with two new worlds.

There is a thread by some user on reddit as well:
https://www.reddit.com/r/cataclysmdda/comments/6qfkmm/infernal_lag_help_meh_d/?st=j5qr76ca&sh=e914b35e

Performance

Most helpful comment

In map::build_transparency_cache, the weather_data object is retrieved for every tile in the outside_cache when you cross a submap (12 tiles in one direction). The code from #21507 is retranslating the weather name for each tile (~10000 times). I tried placing a weather_datum wd = weather_data(g->weather); outside the for loop that covers the map and referenced it instead of calling a new weather_data each loop and it looks like the lag stopped.

if( outside_cache[x][y] ) {
    value *= weather_data(g->weather).sight_penalty;
}
if( outside_cache[x][y] ) {
    value *= wd.sight_penalty;
}

All 4 comments

Seems that #21507 causes the problem.

Can confirm. Running on an intel quad core i7 at 3.6 GHZ, and a 970 (Not like graphics card should matter much) with 8gb of ram, windows 10 64 bit.

Random "hangs" for a few seconds every so often.

I noticed there's a "Const" in getting weather name added by #21507 I guess that is making it happen every turn, and hogging resources? Just a guess, as it's the only "major" thing changed in that PR.

That's a very strange thing to cause a performance regression, I'll do some profiling and see what I get.

In map::build_transparency_cache, the weather_data object is retrieved for every tile in the outside_cache when you cross a submap (12 tiles in one direction). The code from #21507 is retranslating the weather name for each tile (~10000 times). I tried placing a weather_datum wd = weather_data(g->weather); outside the for loop that covers the map and referenced it instead of calling a new weather_data each loop and it looks like the lag stopped.

if( outside_cache[x][y] ) {
    value *= weather_data(g->weather).sight_penalty;
}
if( outside_cache[x][y] ) {
    value *= wd.sight_penalty;
}
Was this page helpful?
0 / 5 - 0 ratings