CC: Tweaked

CC: Tweaked

42M Downloads

Reducing ticking

SquidDev opened this issue ยท 0 comments

commented

Some commonly placed blocks in CC(:T) have tiles which implement ITickable. Despite they do very little work, it does adds substantial overhead to each tick which would be nice to avoid. The main culprits are as follows:

TileCable

https://github.com/SquidDev-CC/CC-Tweaked/blob/b8957cab5c3c3829f4931dd21faf39323e45fa87/src/main/java/dan200/computercraft/shared/peripheral/modem/TileCable.java#L468-L486

Most of this is just "on first tick" logic, so could potentially be shifted somewhere else?

TileMonitor

https://github.com/SquidDev-CC/CC-Tweaked/blob/b8957cab5c3c3829f4931dd21faf39323e45fa87/src/main/java/dan200/computercraft/shared/peripheral/monitor/TileMonitor.java#L148-L186

Only the primary monitor really needs to tick. While I'd like to avoid having "main" and "non-main" monitor TEs, we should investigate ways to only have one ticking monitor.

TilePrinter

This currently doesn't tick, though may not actually be threadsafe - we're calling .setAnim on the computer thread.

Others?

Could we potentially do the same for other modems - most just run logic on the first tick and then never again after that.