Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved loading causes high CPU use with long trains #423

Closed
DorpsGek opened this issue Nov 29, 2006 · 4 comments
Closed

Improved loading causes high CPU use with long trains #423

DorpsGek opened this issue Nov 29, 2006 · 4 comments
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

Danny opened the ticket and wrote:

  1. A test with 40 trains, each 100 cars taking passengeres between 2 stations used between 10 & 20 % cpu and caused the game to jolt every couple of secconds.
    This is occuring in the attached saved game.
    Turning 'improved loading algorithm' off reduced cpu to 0% and things ran normally.

    The config attached was used to create the game, but I have altered some of the YAPF settings in game which may assert with revisions before ~725x.

  2. This is not confirmed, but I am suspicious that the rating calculations do not reach 100% when they should when using improved loading.

Attachments

Reported version: Bridge branch (dev)
Operating system: All


This issue was imported from FlySpray: https://bugs.openttd.org/task/423
@DorpsGek
Copy link
Member Author

Danny wrote:

It's trunk, not bridge branch - my mistake.
I'll take a look at it & see if I can sus out the profiler thing.


This comment was imported from FlySpray: https://bugs.openttd.org/task/423#comment664

@DorpsGek
Copy link
Member Author

Danny wrote:

I couldn't run the profiler since I've only got MSVC Pro at the mo. Anyway, I think the problem is that for each car, it checks each other car or more to see if it should load or not - LoadWait(). This may be ok with 10 cars, but 100 cars probably does 100*100 checks.
If I knew enough C I would setup a queue of vehicle references for each cargo type at the station. Trains which needed to wait for cargo would add their cars to the appropriate queue, and wait. When cargo arrived at the station, it would be transfered to the vehicles in the queue. This way no looping or checking needs to be done, and it would be easier to modify the loading order for any new features.
Maybe some other time, or maybe it's already done in the MiniN, but I've had my fill of C for now.


This comment was imported from FlySpray: https://bugs.openttd.org/task/423#comment665

@DorpsGek
Copy link
Member Author

DorpsGek commented Dec 7, 2006

Darkvater wrote:

Confirmed (CPU usage). VS Profiler says the following:
LoadWait 46.083 46.083 847 847

o_O using 46% of the CPU time...good, very good...


This comment was imported from FlySpray: https://bugs.openttd.org/task/423#comment684

@DorpsGek
Copy link
Member Author

Rubidium closed the ticket.

Reason for closing: Fixed

In r9683.


This comment was imported from FlySpray: https://bugs.openttd.org/task/423

@DorpsGek DorpsGek added Core flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) labels Apr 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)
Projects
None yet
Development

No branches or pull requests

1 participant