]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
updated dictionary compression paragraph
authorYann Collet <cyan@fb.com>
Mon, 6 Feb 2017 18:07:22 +0000 (10:07 -0800)
committerYann Collet <cyan@fb.com>
Mon, 6 Feb 2017 18:07:22 +0000 (10:07 -0800)
index.html

index 4689bfdff4d7c1050e520c41804e6cbb07208c5e..3e4520f8fe33b9154dd7c01ff8c34ba047bff5dc 100644 (file)
@@ -126,22 +126,29 @@ For a larger picture including very slow modes, [click on this link](https://raw
 <a name="small-data"></a>
 ### The case for Small Data compression
 
-Previous charts provide results applicable to typical files and streams scenarios (several MB). Small data come with different perspectives. The smaller the amount of data to compress, the more difficult it is to achieve any significant compression.
+Previous charts provide results applicable to typical file and stream scenarios (several MB). Small data comes with different perspectives.
 
-This problem is common to any compression algorithm. The reason is, compression algorithms learn from past data how to compress future data. But at the beginning of a new file, there is no "past" to build upon.
+The smaller the amount of data to compress, the more difficult it is to compress. This problem is common to all compression algorithms, and reason is, compression algorithms learn from past data how to compress future data. But at the beginning of a new data set, there is no "past" to build upon.
 
-To solve this situation, Zstd offers a __training mode__, which can be used to tune the algorithm for a selected type of data, by providing it with a few samples. The result of the training is stored in a file called "dictionary", which can be loaded before compression and decompression. Using this dictionary, the compression ratio achievable on small data improves dramatically :
+To solve this situation, Zstd offers a __training mode__, which can be used to tune the algorithm for a selected type of data.
+Training Zstandard is achieved by provide it with a few samples (one file per sample). The result of this training is stored in a file called "dictionary", which must be loaded before compression and decompression.
+Using this dictionary, the compression ratio achievable on small data improves dramatically.
 
-<img src="https://raw.githubusercontent.com/facebook/zstd/master/doc/images/smallData.png" alt="Compressing Small Data" style="height:600px;">
+The following example uses the `github-users` [sample set](https://github.com/facebook/zstd/releases/tag/v1.1.3), created from [github public API](https://developer.github.com/v3/users/#get-all-users).
+It consists of roughly 10K records weighting about 1KB each.
 
-These compression gains are achieved while simultaneously providing faster compression and decompression speeds.
+Compression Ratio | Compression Speed | Decompression Speed
+------------------|-------------------|--------------------
+![Compression Ratio](https://raw.githubusercontent.com/facebook/zstd/master/doc/images/dict-cr.png "Compression Ratio") | ![Compression Speed](https://raw.githubusercontent.com/facebook/zstd/master/doc/images/dict-cs.png "Compression Speed") | ![Decompression Speed](https://raw.githubusercontent.com/facebook/zstd/master/doc/images/dict-ds.png "Decompression Speed")
 
-Dictionary work if there is some correlation in a family of small data (there is no _universal dictionary_).
-Hence, deploying one dictionary per type of data will provide the greater benefits. Dictionary gains are mostly effective in the first few KB. Then, the compression algorithm will rely more and more on previously decoded content to compress the rest of the file.
 
-#### Dictionary compression How To :
+These compression gains are achieved while simultaneously providing _faster_ compression and decompression speeds.
+
+Training works if there is some correlation in a family of small data samples. The more data-specific a dictionary is, the more efficient it is (there is no _universal dictionary_).
+Hence, deploying one dictionary per type of data will provide the greatest benefits.
+Dictionary gains are mostly effective in the first few KB. Then, the compression algorithm will gradually use previously decoded content to better compress the rest of the file.
 
-##### _Using the Command Line Utility_ :
+#### Dictionary compression How To :
 
 1) Create the dictionary
 
@@ -149,11 +156,11 @@ Hence, deploying one dictionary per type of data will provide the greater benefi
 
 2) Compress with dictionary
 
-`zstd FILE -D dictionaryName`
+`zstd -D dictionaryName FILE`
 
 3) Decompress with dictionary
 
-`zstd --decompress FILE.zst -D dictionaryName`
+`zstd -D dictionaryName --decompress FILE.zst`
 
 
 <br/>