mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-07-06 12:02:52 +00:00

Previously we would compute the current timeout flags every 128 instructions of the Lua machine. While computing these flags is _relatively_ cheap (just get the current time), it still all adds up. Instead we now set the timeout flags from the computer monitor/watchdog thread. This does mean that the monitor thread needs to wake up more often[^1] _if the queue is full_, otherwise we can sleep for 100ms as before. This does mean that pausing is a little less accurate (can technically take up 2*period instead). This isn't great, but in practice it seems fine - I've not noticed any playability issues. This offers a small (but measurable!) boost to computer performance. [^1]: We currently sleep for scaledPeriod, but we could choose to do less.