Lag caused by render
KindarConrath opened this issue ยท 4 comments
Yep. This is a thing. Not really a bug, but circuit rendering is "just working" for the time being.
I plan on investing a lot more time into testing and optimizing to try to get the rendering code to be as efficient as possible in the near future, but for now it's bundled with chunk rendering, so any updates to the chunk the circuit is in will trigger the whole circuit to re-render and vice versa, which understandably can be a bit heavy.
I'll keep this issue open to log development progress around this topic.
I have encountered this issue as well, though I am very confident that the cause is a completely different one:
Putting the circuit in the screenshot together with a running piston clock in the same chunk doesn't influence my frame rate at all.
But as soon as my crosshair enters the block space of the circuit (even the empty area), my FPS crash from 120 down to 1.
The most likely cause of this is here: https://github.com/TechnicalitiesMC/SuperCircuitMaker/blob/main/src/main/java/com/technicalitiesmc/scm/block/CircuitBlock.java#L163-L194. Calculating a VoxelShape
is a really expensive operation and you are building the shape from scratch multiple times per frame due to the many things that call Block#getShape()
.
The versions are exactly the same as OP's, with the only difference being that I don't have JEI installed.
That is a very good point.
It's an optimization I was planning to make soon-ish, but I'll push it up the priority list.
v0.1.1 is now live with the fix:
CurseForge: https://mc-mods.cf/super-circuit-maker/files/3599322
GitHub: https://github.com/TechnicalitiesMC/SuperCircuitMaker/releases/tag/v0.1.1