Skip to content
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

Optimize tile storage by preventing saving of fully transparent images. #2101

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

LogalDeveloper
Copy link

I manage Redstoner Maps, which hosts Overviewer renders of 9 worlds, each featuring two tile sets: the standard "Overworld" render and a customized cave render named "Underworld". These 18 tile sets collectively held a staggering 22,681,416 files. While this quantity was warranted given the expansive nature of some of the worlds, it posed logistical challenges during a server migration. Consequently, I took a look at Overviewer to identify optimizations capable of reducing the file count without compromising the final map quality.

Across worlds such as BigPlots, Creative, and Trusted on Redstoner Maps, the Underworld tile sets contain vast regions of complete transparency. These areas were represented by individual transparent tiles generated by Overviewer. Furthermore, I observed that navigating beyond the rendered areas prompted Leaflet to request "blank.png" in response to expected 404 errors, effectively serving as a placeholder for missing tiles.

Building upon this existing functionality, this pull request proposes a straightforward yet effective adjustment: introducing a check during rendering to determine whether tiles are entirely transparent before saving them to disk. Tiles identified as fully transparent are excluded from the saving process.

Upon implementing this pull request, I regenerated all 18 tile sets on Redstoner Maps. The resultant file count went from 22,681,416 to a combined total of 8,184,222 files, marking a substantial ~64% reduction. While 8 million files remains considerable, this reduction notably eased the burden on inode usage and simplified data transfer processes for me. Most importantly, this optimization does not compromise the final product; missing tiles are seamlessly replaced with "blank.png" by Leaflet.

This pull request primarily benefits users of the cave renderer, especially on worlds with sparse cave systems, as they are the most likely to contain fully transparent tiles. Most normal renders will not experience significant benefits from this optimization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant