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

NBT minifier #4

Closed
szeweq opened this issue May 2, 2024 · 2 comments
Closed

NBT minifier #4

szeweq opened this issue May 2, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@szeweq
Copy link
Owner

szeweq commented May 2, 2024

NBT files (from Notch's design) have its data compressed using Gzip. MC-Repack should have a special minifier for checking and recompressing this file format. (Suggestion from #2)

It should use either gzip or zopfli.

@szeweq szeweq added the enhancement New feature or request label May 2, 2024
@solonovamax
Copy link

zopfli can be quite slow based on using it in the past, so idk if it's worth using it tbh

here's a test file I ran through it, with the default zopfli iterations (15):

$ time zopfli --gzip -c infwoodfarm.nbt.uncompressed > infwoodfarm.zopfli.nbt

real	0m10.879s
user	0m10.712s
sys	0m0.032s
$ la
total 1.4M
-rw-r--r-- 1 solonovamax solonovamax  91K May  3 12:44 infwoodfarm.nbt
-rw-r--r-- 1 solonovamax solonovamax 1.2M May  3 12:45 infwoodfarm.nbt.uncompressed
-rw-r--r-- 1 solonovamax solonovamax  68K May  3 12:47 infwoodfarm.zopfli.nbt

so, it saved 24kb in 10 seconds, on a 91kb source file. (note: du shows it as being 92kb originally, so I'm using that)

decreasing it to only 5 iterations still takes 0m8.855s, but results in a file that is 72kb.

reducing it further to 1 iteration takes 0m8.263s, and the result is a file that is (also) 72kb.

Using 20 iterations takes 0m11.375s, and the result is a file that is 68kb, and using 80 iterations takes 0m20.615s, with the result being still 86kb 68kb.

but, if there's like even 20 or so nbt files in a mod, 10 seconds for each is quite long.

@szeweq
Copy link
Owner Author

szeweq commented May 14, 2024

Feature released in v0.20.0. Issue closed.

@szeweq szeweq closed this as completed May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants