Auto-Switch Techs


Reorder the research queue when one science pack runs out

Utilities
a month ago
2.0
1.79K

g [Fixed] Lag spike

3 months ago
(updated 3 months ago)

Hi,

I get periodic lag spike from this mod, spiking ip to over 2 ms for an update.

Any way to reduce it or smooth it out over time, since this sudden spike makes the game hang for a momend every 10-20 seconds, even on 60ups

3 months ago

Huh, I didn't notice it but now that you mention it my game had a lag spike of 70ms every 10 seconds. I just made a new version that should fix it. It will still stutter when you first load the game and after you build or destroy labs, but the rest of the time it should be gone. Let me know if you still have issues.

The problem was that the mod was searching for all labs on all surfaces every 10 seconds (or whatever you set for "Run every N seconds" setting). The change I made was caching the list of labs and clear the cache when labs get built/destroyed. On my game it used to be 70ms to fetch labs and 0.5ms to look through them, now it is 0.004ms to fetch labs (once they're cached) and still 0.5ms to look through them. There are still some optimizations I could make, eg instead of searching for labs just add/remove from the cache, and could maybe optimize the process of looking through labs.

3 months ago

sounds good, trying now!

Thanks so far

3 months ago
(updated 3 months ago)

Its better now, although i notice some spikes from (3ms to 7 ms) in "entity-Update" now i havent seen before...
its just that, not ur script.
Cant say if its even linked...

edit: nevermind, its linked to the "beam" entity....

New response