]> git.ipfire.org Git - thirdparty/zstd.git/commit
clean ZSTD_compress() initialization 1170/head
authorYann Collet <cyan@fb.com>
Thu, 7 Jun 2018 20:53:30 +0000 (13:53 -0700)
committerYann Collet <cyan@fb.com>
Thu, 7 Jun 2018 21:05:25 +0000 (14:05 -0700)
commite3c42c739b3e4e7541b9c9f6d063231819e866d3
treeaf17efe8b80d6a1af9a1e1b1401dfa09406c7b08
parentb27c7389e3480db04fe429d5d1784aa8d6baa00d
clean ZSTD_compress() initialization

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
lib/compress/zstd_compress.c