[−][src]Function zstd_safe::train_from_buffer
pub fn train_from_buffer(
dict_buffer: &mut [u8],
samples_buffer: &[u8],
samples_sizes: &[usize]
) -> Result<usize, usize>
ZDICT_trainFromBuffer()
Train a dictionary from an array of samples.
Samples must be stored concatenated in a single flat buffer samplesBuffer
,
supplied with an array of sizes samplesSizes
, providing the size of each sample, in order.
The resulting dictionary will be saved into dictBuffer
.
Returns the size of the dictionary stored into dictBuffer
(<= dictBufferCapacity
)
or an error code, which can be tested with ZDICT_isError().
Tips : In general, a reasonable dictionary has a size of ~ 100 KB.
It's obviously possible to target smaller or larger ones, just by specifying different dictBufferCapacity
.
In general, it's recommended to provide a few thousands samples, but this can vary a lot.
It's recommended that total size of all samples be about ~x100 times the target size of dictionary.