I previously wrote an article about integrating the ZSTD compression algorithm into UE: ModularFeature: Integrating ZSTD Compression Algorithm into UE4, and extracted the Oodle compression algorithm library from UE5 for use in UE4: Oodle Compression. Recently, I analyzed their compression, decompression, CPU, and memory consumption, testing on three platforms: WindowsNoEditor, Android_ASTC, and iOS, as well as the performance of Oodle’s Kraken using different compression levels on different platforms.
Packaging and testing methods:
- Create a default zlib base package that does not contain any resources.
- The base package includes code for oodle/zstd, allowing specification of the compressor and compresslevel at startup.
- Use HotPatcher to package StarterContent. Each time, package for three platforms, specifying the compression algorithm, compressor, and compression level through commands.
- During runtime, use Perfdog and
stat compression
to view data.
The sizes of the StarterContent packaged with different compression algorithms (in MB). The size of the uncompressed Pak:
Uncompress Pak | Size |
---|---|
WindowsNoEditor | 465M |
Android_ASTC | 260M |
iOS | 291M |
In the following data, Oodle uses the default Fast
compression level, with the distinction being the different compressors.
- | ZLIB | OODLE(Kraken) | OODLE(Leviathan) | Oodle(Hydra) | ZSTD(Level22) |
---|---|---|---|---|---|
WindowsNoEditor | 295.93 | 284 | 273.18 | 278.40 | 286 |
Android_ASTC | 177 | 170 | 165 | 167 | 171 |
iOS | 174 | 162 | 155 | 158 | 163 |
In Oodle’s Fast
mode, packaging StarterContent for the Android_ASTC
, iOS
, and WindowsNoEditor
platforms took approximately 35 seconds in total just for packing the Pak.
When the compression level is set to the maximum Optimal5
, the compression speed significantly decreases, but the compression ratio noticeably improves, taking about +00:06:55.764
across three platforms, which is roughly seven minutes.
- | Leviathan(Fast) | Leviathan(Optimal5) | Leviathan(Optimal2) | ZSTD Level 22 |
---|---|---|---|---|
WindowsNoEditor | 273.18 (13.54s) | 263 (180.63s) | 266 (41.69s) | 286(31.24s) |
Android_ASTC | 165 (8.39s.) | 152 (95.59s) | 157 (23.19s) | 171(19.86s) |
iOS | 155 (10.38s) | 147 (138.13s) | 150 (34.96s) | 163(20.43s) |
Comparison of Kraken using different compression levels (runtime comparison data is at the end of the document):
- | Kraken(Fast) | Kraken(Optimal5) | Kraken(Optimal2) |
---|---|---|---|
WindowsNoEditor | 283 (5.83s) | 273 (82.24) | 276 (41.69s) |
Android_ASTC | 170 (3.52s.) | 161 (49.88s) | 166 (23.19s) |
iOS | 161 (4.01s) | 152 (57.34s) | 155 (34.96s) |
Using stat
combined with PerfDog to analyze the efficiency of various compression algorithms, the testing method involved loading Pak packaged with different compression algorithms, entering the same map (/Game/StarterContent/Maps/StarterMap
), enabling stat compression
, and reviewing performance data after three minutes of navigating the entire scene (for mobile, PerfDog analysis is enabled, which may have some performance impact, but all mobile tests use the same operations and processes, making the data comparison accuracy acceptable).
WindowsNoEditor
- zlib
- oodle(Kraken+fast)
- oodle(Hydra+fast)
- oodle(Leviathan+fast)
- zstd(level22)
Android_ASTC
zlib
oodle(Kraken+fast)
oodle(Hydra+fast)
oodle(Leviathan+fast)
zstd(level22)
iOS
zlib
oodle(Kraken+fast)
oodle(Hydra+fast)
oodle(Leviathan+fast)
zstd(level22)
Comparison of different Kraken compression levels
The test package and Perfdog environment were the same as described above.
WindowsNoEditor
Fast
Optimal2
Optimal5
Android_ASTC
Fast
Optimal2
Optimal5
iOS
Fast
Optimal2
Optimal5
Summary
The compression ratio and decompression performance are factors that trade off against each other. From the comparison data, both Oodle and ZSTD maintain a high compression ratio while far outperforming Zlib in decompression efficiency. The comparison data shows that the performance of ZSTD at level 22 is comparable to that of Oodle’s Leviathan, while Kraken excels in decompression speed. Therefore, using Kraken+fast in games is a fairly reasonable solution. Even when selecting other CompressLevel
options like Optimal2
or Optimal5
, the compression time can increase several times, which may not be worth it in projects with a large amount of resources.