News:

Simutrans Wiki Manual
The official on-line manual for Simutrans. Read and contribute.

Newly compiled way-improvements performance issues

Started by Junna, August 19, 2014, 04:04:13 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Junna

New compile, as compared to a week ago, now has some performance issues. Every in-game minute the game on fast-forward would freeze for a second or two. By manually disabling all cities growth, the issue goes away. (Monthly growth was 1,097,000 for 97 cities totalling 1.7 million...)

jamespetts

Thank you for reporting this. The only changes that have been made are Philip's patches; I wonder whether Philip might be able to look into this?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Philip

#2
Quote from: Junna on August 19, 2014, 04:04:13 PM
New compile, as compared to a week ago, now has some performance issues. Every in-game minute the game on fast-forward would freeze for a second or two. By manually disabling all cities growth, the issue goes away. (Monthly growth was 1,097,000 for 97 cities totalling 1.7 million...)

That sounds like my code is very likely the culprit. Sorry about that. I'm compiling the way-improvements branch now and will look into what's causing the freeze if I can reproduce it here (luckily, I've got a very slow computer, by today's standards, so I should be able to).

May I ask you to clarify how you disabled city growth, and whether monthly growth means the statistic available via the city list chart? That would be a valuable hint.

Thanks in advance,
Philip

ETA: Okay, I believe I've got this one tracked down...or at least I've tracked down a bug, and I hope there aren't too many more. Unfortunately, it's a little complicated—it seems we end up very quickly with cities that cannot grow further, and then try an inordinate number of times to expand them.

Would you be able to test the code at
https://github.com/pipcet/simutrans-experimental/compare/jamespetts:way-improvements...junna-13887 ?

Junna

#3
Quote from: Philip on August 19, 2014, 04:20:50 PM
May I ask you to clarify how you disabled city growth, and whether monthly growth means the statistic available via the city list chart? That would be a valuable hint.

Disabled by manually checking all cities and clicking the "disable city growth" option. It was quite the pain in the ****, really. And yes, for the latter, via the city list chart.

I shall test that linked one.

Addendum: With that version it does not appear to be reproducible.

Would it be possible to do something temporary to deal with the absurd growth rate though, in the time until that new city growth thing is done? It almost makes it almost unplayable when towns, without any service, explode in population by hundreds of percent per year. A city of 20,000 grows by 5,000 per month... exponentially filling the entire map.

Philip

Quote from: Junna on August 19, 2014, 06:10:22 PM
Disabled by manually checking all cities and clicking the "disable city growth" option. It was quite the pain in the ****, really. And yes, for the latter, via the city list chart.

I shall test that linked one.

Addendum: With that version it does not appear to be reproducible.

Would it be possible to do something temporary to deal with the absurd growth rate though, in the time until that new city growth thing is done? It almost makes it almost unplayable when towns, without any service, explode in population by hundreds of percent per year. A city of 20,000 grows by 5,000 per month... exponentially filling the entire map.

I have a suspicion what might be causing such extreme growth rates, but I'm not totally sure about it. Are you playing with a high bits_per_month value rather than the default of 18, by any chance? I think our adjustment for high bpm values is in fact doing the opposite and making growth faster rather than slower for high bits_per_month values. If you have the time, it would be great if you could confirm that growth rates are okay with bpm=18,  or try the following patch:


diff --git a/simcity.cc b/simcity.cc
index d9caeeb..17e5373 100644
--- a/simcity.cc
+++ b/simcity.cc
@@ -2625,10 +2625,10 @@ void stadt_t::calc_growth()
const sint64 tpm = welt->ticks_per_world_month;
const sint64 old_ticks_per_world_month = 1LL << 18;
if (tpm > old_ticks_per_world_month) {
- new_wachstum *= (tpm / old_ticks_per_world_month);
+ new_wachstum /= (tpm / old_ticks_per_world_month);
}
else {
- new_wachstum /= (old_ticks_per_world_month / tpm);
+ new_wachstum *= (old_ticks_per_world_month / tpm);
}

wachstum += new_wachstum;


ETA: And thank you for testing! I shall submit a pull request for the first issue, and hopefully we'll get to the bottom of the second issue as well. Just to confirm, the extraordinary growth rates were present last week as well, correct?

Thanks again,
Philip

Junna

Quote from: Philip on August 19, 2014, 06:47:10 PM
Just to confirm, the extraordinary growth rates were present last week as well, correct?

They were indeed - they have been a problem plaguing experimental for a long time now (as evidenced by how the multiplayer game turned out).

Population growth does indeed appear not outrageous with 18bpm (I was using 22 previously), a city of 1,000 growing between 0 and 24 people per month.

HOWEVER: Changing bpm from 22 to 18; a city with a population of 14,000 ends up having a population of 944... Something is clearly off here.

prissi

Btw, there are functions for scaling numbers with bits per month in simworld, scale_with_month_length and inverse_scale_with_month_length

Junna

So, could any of these issues be fixed, since there is something that clearly is wrong?

Philip

Quote from: Junna on August 27, 2014, 05:56:06 AM
So, could any of these issues be fixed, since there is something that clearly is wrong?

The growth speed issue and the original freezing issue should be fixed on James's way-improvements branch. That the population of a city is "adjusted" to scale with month length is, I believe, intentional. If I understood correctly, the idea is to make it easier for players to go from population to trips per month.

Please do report if the first two issues are still around.

Junna

Oh, I was unaware you had pushed that fix. I shall test it, then.