Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: LCS Performance problems  (Read 1726 times)

jack3604

  • Escaped Lunatic
    • View Profile
LCS Performance problems
« on: February 27, 2015, 10:01:23 pm »

I've been playing the same save for about 6 months now (real time) and once you get to a certain amount of time in game the performance of the game is much, much slower. Is there any way to fix this? Does this happen because of lots of math going on in the background?

Note: This is not an old shit computer.
Logged

SlatersQuest

  • Bay Watcher
    • View Profile
Re: LCS Performance problems
« Reply #1 on: February 28, 2015, 09:56:24 am »

Sounds like a memory leak.

The solution is to quit the game (which saves it), and then restart it. If that doesn't help, then it's an issue with your computer, not the game.
Logged

zaimoni

  • Bay Watcher
    • View Profile
Re: LCS Performance problems
« Reply #2 on: February 28, 2015, 08:55:02 pm »

Sorry, LCS is not numerically intensive.  I haven't audited the game carefully for memory leaks, but anything that mixes raw pointers with std::vector or std::deque is asking for trouble.  There are helper functions intended to help work around this issue.

The Microsoft C library's implementation of malloc doesn't really help here (it can "reorganize" itself to go non-performant).

Logged

Carlos Gustavos

  • Bay Watcher
    • View Profile
Re: LCS Performance problems
« Reply #3 on: March 01, 2015, 05:32:44 am »

There is a performance issue with the xml in the save file. If you get enough liberals, vehicles and items it will start taking a noticeable amount of time to write the save file. You can try turning off autosaving if you're not afraid of crashes.
Logged

Purple Gorilla

  • Bay Watcher
    • View Profile
Re: LCS Performance problems
« Reply #4 on: March 13, 2015, 04:21:32 pm »

Try erasing your GAMELOG.TXT. Every important line is written into the file, so after some months of intensive playing it will reach an enourmous size. (~1MB per game).

Appending to a file is more time consuming than one would assume. Files are divided into clusters, and the FAT table listing the order of the clusters. The Directory Entry of the File contains the starting cluster, and the FAT entrys of clusters are pointers to the next Cluster. This Data strcuture is a chain-linked list, that has bad performance if you want to acces entries at the end of the file. Normally this is migitated by the fact that the FAT-Buffer of the OS will hold a large amount of FAT entries so it is possible to find the end of the file by just reading a few sectors from the FAT, while the actual searching is done in RAM. The GAMELOG.TXT however is a log file, that is written in tiny pieces, while inbetween other files are deleted or written, meaning that it is highly fragmented. Such a high fragmentation means in the worst case that the OS must read a sector for every single FAT entry, and takes a notable time to find the end.

EDIT: Don't erase it while you are playing. First leave LCS, Second erase the File, Third Run LCS again. (Erasing an open file might cause trouble). A good rule of thumb is erasing it every time you finish a game.
« Last Edit: March 13, 2015, 04:24:57 pm by Purple Gorilla »
Logged