Project-Poseidon icon indicating copy to clipboard operation
Project-Poseidon copied to clipboard

[WIP] Chunk compression improvements.

Open gibsonpil opened this issue 1 year ago • 0 comments

This pull request is intended to backport some of the improvement made to chunk compression in newer updates and also introduce some new ones.

Todo List:

  • [x] Allow setting the world compression type (backport from 24w04a).
  • [x] Allow disabling world compression.
  • [x] Add lz4 support (backport from 24w04a).
  • [x] Add xz support.
  • [ ] Allow switching block ordering from XZY to YZX (backport from Anvil).
  • [ ] Add support for immediately resaving chunks with these changes applied.

I've also generated (unscientific) benchmarks by regenerating a world with the same seed, immediately exiting the server, and marking down the file size generated by each compression type. I will write a proper, scientific benchmark later.

Unscientific Benchmarks:

Format Compression Ratio
none 1
gzip ~0.0539
deflate ~0.0533
lz4 ~0.0672
xz ~0.0238

EDIT: Dropped idea of adding ZSTD support. It doesn't have a Java native version compatible with Java 1.8, and bundling a native version to use with the JNI would just overcomplicate things.

EDIT 2: Ran some benchmarks and decided XZ would be an appropriate substitute for ZSTD.

gibsonpil avatar Jan 13 '25 20:01 gibsonpil