Welcome to Keen Software House Forums! Log in or Sign up to interact with the KSH community.
  1. You are currently browsing our forum as a guest. Create your own forum account to access all forum functionality.

Best way to investigate low sim speed?

Discussion in 'Programming (In-game)' started by Concave, Feb 5, 2017.

Thread Status:
This last post in this thread was made more than 31 days old.
  1. Concave Apprentice Engineer

    Messages:
    104
    Is there a sort of task manager tool in the game world that would help me isolate the source of low sim speed?

    I know the "Echo" function is usually to blame for memory leaks, and I still have a few grids with it in their code, but none of them are running and I can't seem to find the source of the problem.

    EDIT:
    The irony is that all this happened because I was trying to consolidate all my debugging strings into one central location by transmitting a string with log data to a designated text panel on a separate dedicated "debugging" grid.

    The problem turned out to be each of the 8 grids in question having TransmitMessage in their script outside of an if statement, so each time one PB ran, it transmitted a formatted debugging string to all the others. Since they had no way to handle the data, it just ran their Transmit as well, causing them to all be run constantly.

    All is well now.
     
    Last edited: Feb 5, 2017
    • Funny Funny x 1
  2. Malware Master Engineer

    Messages:
    9,602
    Echo is not likely to leak memory, it is far too simple for that. All it does is add text to a StringBuilder, which is force-kept below a certain size. When the run its complete, it's content is put into the DetailInfo property. That's it.
     
    • Informative Informative x 1
  3. Lynnux Junior Engineer

    Messages:
    881
    What he meant is that you have something like:

    if(debug) EchoString = "Initial string";

    EchoString += "\n15 bytes added"; //debug condition forgotten

    if(debug) Echo(EchoString);


    Now set debug to false and run that every tick and the GC memory will increase rapidly. I once managed to fill the RAM to the SE limit of 16 GB in 8 seconds this way causing a game freeze of a second every 8 seconds.
     
  4. Acolyte Apprentice Engineer

    Messages:
    109
    Is this really a thing ? I have a save that is basically dead because of simspeed. I assumed it was because I had too may grids, components and conveyors, but I was also developing some scripts and I had just build an in-game temporary IT centre to house a few PB and LCD combos.

    Some of those PBs do have scripts that overfill the echo buffer, but I just assumed it was not written to when full rather than an actual uncontrolled overflow. Also the scripts are batch run from the PB, not linked to timers.

    Have I been nobbling my game with these scripts ?
     
  5. Malware Master Engineer

    Messages:
    9,602
    @Acolyte No
    This would be a mistake of the scripter themselves, the game's echo buffer can't be overflowed
     
Thread Status:
This last post in this thread was made more than 31 days old.