The International Simutrans Forum

Simutrans Extended => Simutrans-Extended bug reports => Simutrans-Extended development => Simutrans-Extended closed bug reports => Topic started by: Rollmaterial on December 04, 2017, 06:24:43 PM

Title: CPU surge
Post by: Rollmaterial on December 04, 2017, 06:24:43 PM
In this save, after the next month begins, CPU usage surges and the game freezes.

.sve: https://drive.google.com/file/d/1NRvgzoxwhKhI0BCJ8PXbtnRU3JFakCCW/view?usp=sharing
Title: Re: CPU surge
Post by: jamespetts on December 05, 2017, 01:40:09 AM
I have spent some considerable time looking into this just now. I am still not sure exactly what is behind this: the performance profiler shows that it is the passenger generation code that is taking up most of the CPU's time after the new month - but the passenger generation code is also taking up most of the CPU's time before the new month, and the game is rather more responsive then.

I have, however, pushed an optimisation fix which should make the passenger generation code more efficient. On my debug build, it seems only to make a slight difference, but it might be more noticeable on a release build.

I should be grateful if you could let me know whether things are any better with to-morrow's nightly build.
Title: Re: CPU surge
Post by: Rollmaterial on December 05, 2017, 06:22:02 PM
While it did slightly improve performance, the surge still occurs and makes the game barely any more playable.
Title: Re: CPU surge
Post by: jamespetts on December 05, 2017, 06:52:32 PM
Thank you for re-testing this. Can I check whether you have changed any of the default settings? This might help me in tracking down the cause of the issue.
Title: Re: CPU surge
Post by: Rollmaterial on December 05, 2017, 07:03:05 PM
Please do so, do you need my config files?
Title: Re: CPU surge
Post by: jamespetts on December 05, 2017, 07:34:30 PM
If you could just summarise what changes that you have made, that would be helpful.
Title: Re: CPU surge
Post by: Rollmaterial on December 05, 2017, 07:49:01 PM
The map is legacy from before 13.0 (obviously). It has meters_per_tile = 117, citycar_level = 1, passenger_trips_per_month_hundredths = 100, max_onward_trips = 3, onward_trip_chance_percent = 90 and commuting_trip_chance_percent = 67 as far as I can remember which settings I altered.
Title: Re: CPU surge
Post by: jamespetts on December 06, 2017, 01:51:41 AM
I have just fixed a bug which I believe was largely responsible for this error, causing the number of alternative destinations to be excessive when the number was re-evaluated at the end of the month.

I also find that reducing the percentage of onward trips from 80 to the default of 25 significantly improves performance.

I should be grateful if you could let me know whether this is improved with to-morrow's nightly build.