New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace clientmap's MeshBufListList with a hashmap #14184
Conversation
Idk how to write an automatic benchmark for client rendering performance though. |
Oh, you're right. I didn't see that the code that uses this data structure is so closely linked to actual drawing. |
I have not seen this in any profiling I did. But I believe you. I will try this today! |
Note that this is not a bottleneck if the scene is simple, for example a fresh mapgen'ed mtg world. You need a scene with many different materials, aka many different node tiles / different textures, for example a busy spawn of a server. |
Tested in an open scene, some trees, many rocks, water, sand, etc. Did not see any measurable difference. It also did not make it worse. :) |
Ah, good to hear that the happy little trees did not get slower. c: I've now added some benchmarks I got from a scene of a server spawn, where I got a 9% drawtime reduction. This is not easily reproducible for you though. I've also got hotspot to work again (thanks to its appimage distribution). Here are some flamegraphs that I got with my testing mod: You might also notice that the shader constant setter callbacks are another bottleneck. We can probably optimize here. Time of day is not different per mapblock, for example. |
I definitely saw the shader constant setter in profiling before. |
Removed PtrHash, see #14184 (comment). PR is ready now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works well. No issues found so far. Thank you.
MeshBufListList::add
is a bottleneck.(I sadly can't reproduce the profiling results right now, because I can't get hotspot to work again.)MeshBufListList::add
has O(n) time where n is the number of unique materials in mapblocks in the scene. And it is called for each meshbuffer.MeshBufListMaps
).To do
This PR is a Ready for Review.
TODO: Where should I putPtrHash
?How to test