EngineHub / CraftBook

🔧 Machines, ICs, PLCs, and more!
https://enginehub.org/craftbook/
GNU General Public License v3.0
301 stars 160 forks source link

Fix a problem where self triggered ICs could cause chunk thrashing #1272

Closed DarkArc closed 3 years ago

DarkArc commented 3 years ago

A chunk monitor system I wrote to detect chunk thrashing and help prevent performance problems and disk wear detected issues with CraftBook's self triggered ICs.

The problem is effectively that an IC could check for input or set an output at cx +/-1, cz +/-1. This would then load the chunk, only for it to be quickly unloaded because it wasn't supposed to be running.

To resolve this, this patch "pauses" self triggered processing if any of the adjacent chunks are unloaded, waiting for a player to get closer.

DarkArc commented 3 years ago

To give some context to this problem, in one recent instance, this caused 200 unnecessary chunk load/unload cycles within a minute, from a single IC (and this is not unusual).

me4502 commented 3 years ago

This is meant to presumably target master?

DarkArc commented 3 years ago

Yeah, but I built it on the gradle-7 hotfix so it's targeting that instead for the moment.

Shouldn't be an issue with a cherry pick.

me4502 commented 3 years ago

Needs a rebase on master