Support LZ4 compression
ngld opened this issue · 0 comments
ngld commented
Thanks to @Shivansps, FSO supports compressing both loose files as well as files in VPs using LZ4. However, while a compressed VP is smaller than an uncompressed VP, a .7z
of an uncompressed VP is smaller than a .7z
of a compressed VP. This is the result of the unfortunate fact that compressing already compressed data usually doesn't work well.
This means in practice that we don't want to upload compressed VPs to Nebula. Instead, we'd apply the LZ4 compression after we extract the uncompressed VPs from their .7z
archives.
For reference, here is @Shivansps' compression code: https://github.com/Shivansps/VPC_Compressor
Some things to keep in mind:
- Already compressed data isn't worth compressing (textures / images, movies, ...).
- Compression takes a lot of processing power and should use all available cores.
- The compressed VP files save disk space and usually load faster. This effect is more noticable on HDDs than SSDs but the compression doesn't negatively affect loading times on SSDs, either.
- We can only apply LZ4 compression to VPs that are loaded by recent FSO versions since older FSO builds won't be able to read compressed files.