spoutn1k / mcmap

Pixel-art map visualizer for Minecraft. Maps are drawn from an isometric perspective.
GNU General Public License v3.0
312 stars 45 forks source link

Self-serve chunk loading #57

Closed spoutn1k closed 4 years ago

spoutn1k commented 4 years ago

Loading individual chunks by loading and unloading them for each use allows for a significant drop in memory usage. For instance, this is the memory profile from the main branch: before

With an initial buffer allocation for the image, a subsequent ramp-up to load the entire terrain, and a final buffer allocation for the sub-canvas.

The new behavior skips the loading phase, and the initial buffer allocation: after

Both those profiles were calculated on the same world of size ~ 6000x6000.

To accomodate such changes, the entire merging code has been revamped. From there, tiling and file caching will be straightforward to implement.

spoutn1k commented 4 years ago

On the same graph, the gap is more impressive.

combined

That's a 66% memory usage decrease.