e3c42c739b
The (pretty old) code inside ZSTD_compress() was making some pretty bold assumptions on what's inside a CCtx and how to init it. This is pretty fragile by design. CCtx content evolve. Knowledge of how to handle that should be concentrate in one place. A side effect of this strategy is that ZSTD_compress() wouldn't check for BMI2 capability, and is therefore missing out some potential speed opportunity. This patch makes ZSTD_compress() use the same initialization and release functions as the normal creator / destructor ones. Measured on my laptop, with a custom version of bench manually modified to use ZSTD_compress() (instead of the advanced API) : This patch : 1#silesia.tar : 211984896 -> 73651053 (2.878), 312.2 MB/s , 723.8 MB/s 2#silesia.tar : 211984896 -> 70163650 (3.021), 226.2 MB/s , 649.8 MB/s 3#silesia.tar : 211984896 -> 66996749 (3.164), 169.4 MB/s , 636.7 MB/s 4#silesia.tar : 211984896 -> 65998319 (3.212), 136.7 MB/s , 619.2 MB/s dev branch : 1#silesia.tar : 211984896 -> 73651053 (2.878), 291.7 MB/s , 727.5 MB/s 2#silesia.tar : 211984896 -> 70163650 (3.021), 216.2 MB/s , 655.7 MB/s 3#silesia.tar : 211984896 -> 66996749 (3.164), 162.2 MB/s , 633.1 MB/s 4#silesia.tar : 211984896 -> 65998319 (3.212), 130.6 MB/s , 618.6 MB/s |
||
---|---|---|
.. | ||
fse_compress.c | ||
huf_compress.c | ||
zstd_compress_internal.h | ||
zstd_compress.c | ||
zstd_double_fast.c | ||
zstd_double_fast.h | ||
zstd_fast.c | ||
zstd_fast.h | ||
zstd_lazy.c | ||
zstd_lazy.h | ||
zstd_ldm.c | ||
zstd_ldm.h | ||
zstd_opt.c | ||
zstd_opt.h | ||
zstdmt_compress.c | ||
zstdmt_compress.h |