BER entity list sorting shows up in a hot spot in the profiler sometimes, does it actually improve performance?
andreasdc opened this issue ยท 5 comments
It lowers performance by A LOT, it even made my pc burn for a while. For sure with single type entities on the screen it's not a good solution, if it was not benchmarked I don't recommend it at all.
This code is intended to sequence entity rendering such that entities of the same type render right after each other, which ideally improves overall performance since Batched Entity Rendering will then have an easier time batching up rendered entities into rendering buffers.
If you are interested in testing that theory though, it might not be too big of a jump to go from profiling to downloadinga copy of the Iris source code repository and compiling a copy of the mod with the behavior removed, making it possible to test whether it actually improves performance here. The game shouldn't crash with the sorting behavior removed
I don't have the same environment, but if it helps and if it has some downsides, maybe there is a better for example sorting when spawning entities or something like that?
Yeah, looking a bit more I don't think I expected it to actually show in a profile. But ideally the best way would be to change the data structure for storing entities to be sorted so that it's not necessary to do it every frame.
The problem is that BER was designed to not be overly invasive, and such a change could very well be. There are much better ways to solve the Minecraft entity rendering problem if you're willing to be more invasive. In many ways Iris Batched Entity Rendering is just a bandage for a bullet wound when it comes to entity rendering performance.