Cache Performance Issues
GiantLuigi4 opened this issue · 1 comments
So I was trying to optimize my mod, and while profiling what I assumed was my selection logic being slow, I noticed this instead
I, actually tried using a map based voxel shape cache for my mod before and it ended up hurting performance more than it helped
So seeing this, I'm wondering why C&B is using a map based cache?
From my looking around through the C&B codebase, it looks like the shape should be able to be attached to the IAreaShapeIdentifier to get rid of the VoxelShapeManager entirely
I also noticed that ChiselBlockEntity$Identifier#equals() is invoking toArray, which seems pretty unnecessary?
But ultimately I'd recommend just getting rid of the manager entirely, since even with the equals check order swapped around the impact is noticeable with not all that many chiseled blocks
Could also potentially use the map based cache to de-duplicate data and attach the shape to the IAreaShapeIdentifier to remove the repeated lookups?
The big thing is that this ends up slowing down chunk meshing pretty noticeably, since that does rely on information about the voxel shapes, and is having to do that entire equality check I believe multiple times per chiseled block
Game version: 1.20.1
C&B version: latest for 1.20.1
Based off the github, this exists in the 1.20.4 version and "latest" branch too