Repository navigation
Conversation
| [Region compaction](region-compaction.md) automatically reclaims unused space in | ||
| ordinary region files during server/world startup, never on gameplay dimension loads. | ||
|
|
||
| ## Format selection and compatibility |
There was a problem hiding this comment.
Mind splitting that up a bit more? I feel like ZStd, new format and compaction could be their own commits at least, would be easier to review.
|
dict is per dim, trained, then shipped with the mod
|
a7672ce to
0496227
Compare
|
its now 3 separate commits, for easier review |
|
I did some testing with a ~1GB GTNH world (128 chunks pregen'd with DH) While your compact approach works, I have an idea that might be simpler and more effective: We could skip cubes completely if we can easily regen them.
Conceptionally it's very similar to your idea, but it seems a lot simpler than the template approach. Not sure how far you want to go, but there's also other things we can improve - if we make a new format we might as well make it as effective as we can rather than have multiple format changes in succession:
If you want I could PR some changes unto your PR? Size comparison using zstd level1:
[Note: "compact" was written by my test exporter using your eligibility rules and .cce format, not by your code, so your real numbers may differ slightly. It's 30% smaller than today's files, 25% smaller than today's format without holes.] |
|
I tested 3. a bunch |
|
for the grouping I would prefer 2x2x2 over the other options |
|
I'm fine with adding SIMD classes, but we'll have to be careful to use factory methods to provide the compressor because MRJARs don't work with incubating APIs. It would probably be worth it to follow the same pattern as compression, by switching between palettized and non-palettized at runtime by checking the header (or some other variant field, I used headers because it was backwards-compatible with GZIP). I'm sure there's a way to check if the vector API is enabled, allowing us to disable the SIMD palette (de)compressor at runtime. |
… and separate client and server parts
…it for their bundle
…of a failed save batch
|
So I implemented most of your proposed changes @DarkShadow44
Existing worlds are converted gradually as their cubes are saved, unless Overworld region data (region2d, region3d and the compact tables) of the same content
|
|
Fixed a few storage bugs in CC, not introduced in this PR |
|
The compact storage held one lock for everything, this caused the server thread cube reads to wait for the entire save to finish. Reads now no longer wait for saves, in a 2.5 min test this reduced the server thread's lock waiting from 2.4s to 15ms |
I measured both on three worlds (settled GTNH, fresh, converted vanilla), same settings. Agreed, state byte couples us to the column, but it's a lot easier than the sync code you need for templates. In my prototype it's about half the code, so that seems worth it. Also, why keep the other format (COMPACT_EMPTY) in the PR? |
|
It's now 2 bytes per empty cube, a flags byte and the full population status, since 0.5–5% of the empty cubes in my worlds have population 1, which a 0/255 bit can't hold. With your no-lighting case it comes out 0.4–2.6% smaller than the templates on all three worlds. The states live in the column group records and are handled entirely by the storage. A cube's state and its record change in the same write batch. The state is written before the record is removed, and a full record always wins over a state, so there's no column/cube save ordering problem. COMPACT_EMPTY and the template code are gone. Worlds from v0.1.27-alpha-pre get a clear error message instead of the NPE in 0.1.29 |
|
Will take a look the coming days |
Reduces world size by fixing compression of unused buffer space, sharing repeated metadata for empty cubes, and adding Zstd as the default compression. GZIP, LZ4 and uncompressed storage remain available.
Also adds automatic region compaction during server/world startup to reclaim unused space, with a loading progress bar in singleplayer and progress logs on servers. It does not run during gameplay or shutdown.
Existing compression settings are preserved, and existing worlds keep their storage format. Compact empty-cube storage is the default for new worlds.
The total save size was reduced by around 30-50%.