1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-07-05 03:23:20 +00:00
CC-Tweaked/src
Jonathan Coates 65a7370db1
Rethink how computer timeouts are handled
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.
2022-05-04 12:33:14 +01:00
..
generated/resources Make turtle breaking a little more data driven 2021-10-27 19:32:58 +01:00
main Rethink how computer timeouts are handled 2022-05-04 12:33:14 +01:00
test Rethink how computer timeouts are handled 2022-05-04 12:33:14 +01:00
testMod Happy new year 2022-01-01 00:09:34 +00:00
web Some minor documentation improvements 2022-05-02 17:49:32 +01:00