Smart Output CPU usage while idle
CplPibald opened this issue ยท 1 comments
When a Smart Output is idle because it doesn't have any fluid to process, it uses more CPU than it needs to.
Every tick on update() the SO calls canFrozen()
which calls canCast()
, which calls updateRecipe()
, which searches the TConstruct recipe registry for any recipe that matches. When the tank is empty, no recipe will ever match, so we can save some processing by not checking the recipe in this case.
public boolean canFrozen(){
if (tank.getFluidAmount() == 0) { return false; }
boolean hasPowered = world.isBlockPowered(this.pos);
boolean canStart = false;
...
Adding one line above should reduce the CPU usage of an SO most of the time when it doesn't have any fluid in it.
Actually, this looks like it was mostly fixed with #50