summaryrefslogtreecommitdiff
path: root/Source/Core/Common/FileUtil.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2020-10-04 00:09:55 +0200
committerJosJuice <josjuice@gmail.com>2020-10-07 16:40:06 +0200
commit3feea108db690f880f6e30e6e8f974cfbb78eee3 (patch)
treec30a6e5fff71a766116e035931d3023846f0cf17 /Source/Core/Common/FileUtil.cpp
parentebdcddfcd033b1069dc1010f233c19c419680674 (diff)
DiscIO: Decrease RAM usage during zstd compression
By calling ZSTD_CCtx_setPledgedSrcSize, we can let zstd know how large a chunk is going to be before which start compressing it, which lets zstd avoid allocating more memory than needed for various internal buffers. This greatly reduces the RAM usage when using a high compression level with a small chunk size, and doesn't have much of an effect in other circumstances. A side effect of calling ZSTD_CCtx_setPledgedSrcSize is that zstd by default will write the uncompressed size into the compressed data stream as metadata. In order to save space, and since the decompressed size can be figured out through the structure of the RVZ format anyway, we disable writing the uncompressed size by setting ZSTD_c_contentSizeFlag to 0.
Diffstat (limited to 'Source/Core/Common/FileUtil.cpp')
0 files changed, 0 insertions, 0 deletions