Iris Shaders

Iris Shaders

38M Downloads

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

commented

What happened?

When you have a lot of entities spawned you have performance leak on this code:
image

Screenshots

No response

Log output

No response

Minecraft Version

1.20.1

Iris Version

iris-mc1.20.1-1.6.5.jar

Operating System

windows 10

What is your GPU?

1060

Additional context

No response

commented

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.

commented

Is this code needed?

commented

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

commented

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?

commented

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.