Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Cache MapBlock data in the mesh generator thread for less stutter #5595
Adds a MapBlock cache in MeshUpdateThread's MeshUpdateQueue. This way only changed MapBlocks need to be copied from the main thread, plus ones that have timed out from the cache.
Neighboring MapBlocks are often received and updated in close succession to each other, which leads to huge amounts of MapBlocks being fetched from the cache.
This removes the MeshMakeData::fill stutter that is seen on the client when large amounts of received MapBlocks are being handled. There are multiple other unknown sources of stutter left, which can make noticing the difference difficult.
A version with some extra instrumentation can be found at https://github.com/celeron55/minetest/tree/mesh_update_block_cache.
Relates slightly to #5239.
Meshgen block cache size vs. hit %
i7-4800MQ, 16 GB RAM
As the cache limit only dynamically controls the maximum age of blocks in the
I set the default to meshgen_block_cache_size = 20. The hit % is visible in the profiler as "MeshUpdateQueue MapBlock cache hit %". Some measurements on low-end systems could be useful.
On the VE-S server, 96 hit% can be seen when standing still, which indicates all the neighbors