Repository navigation
v0.2.2
-
A session holds a first
Endcall to its declared size. With
InputSize::Exact(n), a session whose whole input arrived in one
Operation::Endcall of any other length used to write a complete frame
for that length, asZSTD_compressStream2does when it replaces the
pledged size. It now fails withEncodeError::InputSizeMismatch, like
every other contradiction of a declared size, so a truncated or overlong
input never yields a frame. Frames whose input matches its declaration
are unchanged and still byte-identical to zstd 1.5.7. -
process_uninitandcompress_to_uninitwrite in place. Both used to
allocate and zero a temporary buffer as large as the destination on every
call, then copy the result over. The encoder now writes into the caller's
MaybeUninitmemory directly, zeroing it only just ahead of each block it
writes there (tracked withborrowed-buf, withoutunsafe), and copies
buffered output in. Bytes, counts, statuses and errors are those of
processandcompress_to_slice. As with those, bytes past the reported
output may now hold zeros or scratch bytes; only the reported prefix is
meaningful. Theencoder_sessionandoutput_capacityfuzz targets cover
both paths, andbenches/compress.rstimes them: with 128 KiB outputs
over 1 MiB of mixed data in 16 KiB chunks,process_uninitat level 1
takes 1.25 ms (was 1.35 ms;process1.26 ms), and with 4 KiB outputs
1.22 ms (was 1.28 ms).compress_to_uninitof 1 MiB of text is 1-2%
faster (level 3: 1.334 ms, was 1.350-1.363 ms). Measured with
cargo bench --bench compress -- 'stream-output|compress_to_uninit'on
Apple Silicon (aarch64-apple-darwin); output is identical.