Skip to content

XZ Support#6721

Closed
Shivansps wants to merge 5 commits into
scp-fs2open:masterfrom
Shivansps:xz-support
Closed

XZ Support#6721
Shivansps wants to merge 5 commits into
scp-fs2open:masterfrom
Shivansps:xz-support

Conversation

@Shivansps

@Shivansps Shivansps commented May 14, 2025

Copy link
Copy Markdown
Contributor

This is a WIP. And im not even sure if it is desired or viable yet.

This work adds xz compressed files support, both single files and compressed packs (.vp.xz).

XZ is no anywhere near as fast as LZ4 in ST decompression, so it strongely depends on MT to keep loading times as short as possible.

The idea behind it as i commented on #6718 is that if we could get use the files that are uploaded to nebula directly, this on top of saving disk space (and saving the process of re-compress later for anyone who wants it), it would also remove the need to extract the files after download and maybe even implement something like zsync.

XZ files are also the regular ones, as random access is in its design, there is no need for specialised compressors. The only real requeriment is to use 1MB solid blocks to try to get as much multi-threading as possible.

My tests so far with the current code on MVP 4.7.3:
Nebula Upload (7z) is 7.95GB.

Extracted (with vps): 17.61GB -
Trailer mission loading time: 0:42 seconds on a NVME

Compressed VPs (.vp.xz) 8.41GB
Trailer mission loading time: 1:01m with my 5800X. (yes speed is more than likely impacted by CPU, a CPU with better ST perf is likely to be faster) Also loading uses multiples threads.

By comparison the VPC version on LZ4 is 10GB and loads on 44s.

Still a lot of to do, still looking if this could be speed up somehow, there are a few warnings to fix and several TODOS around the code, mostly debug checks missings. And this will not compile, i dont know how to include liblzma into the cmake build process, i tried for hours to no avail. One big TODO that will try to commit soon is to disable the decoder buffer optimisation when blocksizes over 4MB are used. What will certanly lead to absurd memory usages.

The corrent most optimised compressor settings are:
1MB solid blocks
1 or 2 MB Dictionary
64 wordsize
Level 9 (Ultra) or Level 8 (max)

So im attaching the header files, the lib and dll needed to compile and run in case anyone wants to try it and im also attaching a script file to compress an entire folder vps with XZ,, you will need to point it to the 7z executable and the folder.
liblzma.zip
7z script.zip

Im attaching compiled builds (this is actually a 7z file)
user_build_202505071036420949.zip

Shivansps added 5 commits May 14, 2025 19:04
Fix some warnings, finish with the TODOs, fix asignation error in cf_clear_compression_info and remove the optimised single block decoder as it was not any faster.
@Shivansps

Copy link
Copy Markdown
Contributor Author

The reason for retire the PR is here.
#6718 (comment)

@Shivansps Shivansps closed this Jun 16, 2025
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