Commit Graph
100 Commits
Author SHA1 Message Date
Yann Collet bb4f85db42 fix version of actions/checkout 2024-03-03 18:47:08 -08:00
Yann Collet 8d31e8ec42 sizeBlockSequences() also tracks uncompressed size
and only defines a sub-block boundary when
it believes that it is compressible.

It's effectively an optimization,
avoiding a compression cycle to reach the same conclusion.
2024-02-26 14:31:12 -08:00
Yann Collet d23b95d21d minor refactor for clarity
since we can ensure that nbSubBlocks>0
2024-02-26 14:06:34 -08:00
Yann Collet 86db60752d optimization: bail out faster in presence of incompressible data 2024-02-26 13:27:59 -08:00
Yann Collet ef82b214ad nit: comment indentation
as reported by @terrelln
2024-02-26 13:23:59 -08:00
Yann Collet aa8592c532 minor: reformulate nbSubBlocks assignment 2024-02-26 13:21:14 -08:00
Yann Collet e0412c2062 fix extraneous semicolon ';'
as reported by @terrelln
2024-02-26 12:26:54 -08:00
Yann Collet 1fafd0c4ae fix minor visual static analyzer warning
it's a false positive,
but change the code nonetheless to make it more obvious to the static analyzer.
2024-02-25 19:45:32 -08:00
Yann Collet 038a8a906b targetCBlockSize: modified splitting strategy to generate blocks of more regular size
notably avoiding to feature a larger first block
2024-02-25 17:39:29 -08:00
Yann Collet 4d2bf7f0f2 removed sprintf usage from zstdcli.c
some static analyzers flag this standard C90 function as unsafe.
2024-02-24 23:03:40 -08:00
Yann Collet f8372191f5 reduced minimum compressed block size
with the intention to match the transport layer size,
such as Ethernet and 4G mobile networks.
2024-02-24 01:59:16 -08:00
Yann Collet f77f634d41 update API documentation 2024-02-24 01:28:17 -08:00
Yann Collet 4b51526412 fix partial block uncompressed 2024-02-24 01:24:58 -08:00
Yann Collet 6719794379 fixed some regressionTests
but not all
2024-02-23 18:48:29 -08:00
Yann Collet 0591e7eea1 minor: fix overly cautious conversion warning 2024-02-23 16:05:09 -08:00
Yann Collet 3b40100058 fix long sequences (> 64 KB) 2024-02-23 15:35:12 -08:00
Yann Collet 6b11fc436c fix issue with incompressible sections 2024-02-23 14:53:56 -08:00
Yann Collet cc4530924b speed optimized version of targetCBlockSize
note that the size of individual compressed blocks will vary more wildly with this modification.
But it seems good enough for a first test, and fix the speed regression issue.
Further refinements can be attempted later.
2024-02-23 14:03:26 -08:00
Yann Collet 68a232c591 benchmark more can test targetCBlockSize 2024-02-23 13:13:03 -08:00
Yann Collet b34517a440 fix cmake build 2024-02-20 20:20:40 -08:00
Yann Collet c2d3570338 fix meson datagen build 2024-02-20 18:17:28 -08:00
Yann Collet 1e240af30a fix datagen size control 2024-02-20 18:06:56 -08:00
Yann Collet 7a225c0c46 internal benchmark: can select size of generated synthetic sample 2024-02-20 15:47:09 -08:00
Yann Collet 83598aa106 datagen generates lorem ipsum by default 2024-02-20 15:24:25 -08:00
Yann Collet 7003c9905e increase word dictionary
for higher variety of messages.
Now, level 5 compresses better than level 4 (by a hair).
2024-02-20 13:27:36 -08:00
Yann Collet 3dbd861b7d runtime weight distribution table
and made small words a bit more common.
2024-02-20 12:26:37 -08:00
Yann Collet 5a1bb4a4e0 add question marks
and (slightly) longer sentences.
2024-02-20 00:37:21 -08:00
Yann Collet 40874d4aea enriched vocabulary again
using real latin sentences from Cicero.

Compression ratio lower again, closer to "real" text,

now level 6 is way better than level 4.

level 5 is still lower than level 4,
but at least it's now higher than level 3.
2024-02-20 00:30:29 -08:00
Yann Collet 1e046ce7fa increase vocabulary size
makes compression a bit less good,
hence a bit more comparable with real text (though still too easy to compress).
level 6 is now stronger than level 4, by a hair.
However, there is still a ratio dip at level 5.
2024-02-20 00:12:32 -08:00
Yann Collet 22574d848d fix issue 5921623844651008
ossfuzz managed to create a scenario which triggers an `assert`.
This fixes it, by giving +1 more space for the backward search pass.
2024-02-06 13:01:14 -08:00
Yann Collet b88c593d8f added or updated code comments
as suggested by @terrelln,
to make the code of the optimal parser a bit more understandable.
2024-02-05 18:32:25 -08:00
Yann Collet 0166b2ba80 modification: differentiate literal update at pos+1
helps when litlen==1 is cheaper than litlen==0

works great on pathological arr[u32] examples
but doesn't generalize well on other files.

silesia/x-ray is amoung the most negatively affected ones.
2024-01-31 11:20:43 -08:00
Yann Collet 4683667785 refactor optimal parser
store stretches as intermediate solution instead of sequences.
makes it possible to link a solution to a predecessor.
2024-01-31 02:51:46 -08:00
Yann Collet de10f56be2 improve high compression ratio for file like #3793
this works great for 32-bit arrays,
notably the synthetic ones, with extreme regularity,
unfortunately, it's not universal,
and in some cases, it's a loss.
Crucially, on average, it's a loss on silesia.
The most negatively impacted file is x-ray.
It deserves an investigation before suggesting it as an evolution.
2024-01-29 23:25:24 -08:00
Yann Collet fd03971252 blindfix meson recipe
note: absence of GLOB capability within meson makes its maintenance more painful.
2024-01-29 15:50:21 -08:00
Yann Collet befcec1788 fix cmake recipe 2024-01-29 15:45:16 -08:00
Yann Collet 3ce4c6e046 fix Visual Studio solutions
note: we probably don't want to maintain VS2008 solution anymore.
Its successor VS2010 is > 10 years old,
which is more or less the limit after which we can stop supporting old compilers.
2024-01-29 15:24:42 -08:00
Yann Collet a261375996 fix paramgrill Makefile recipe 2024-01-29 15:18:27 -08:00
Yann Collet d0b7da30e2 add a lorem ipsum generator
this generator replaces the statistical generator
for the general case when no statistic is requested.

Generated data features a compression level speed / ratio curve
which is more in line with expectation.
2024-01-29 15:00:32 -08:00
Yann Collet e1ef81a3ae add sparc64 compilation test 2024-01-28 20:25:04 -08:00
Yann Collet 2fc7248412 fix cmakebuild test
write it in a way which is more compatible with older versions of cmake (<3.13)

Also:
fix pzstd compilation (notably on macos)
2024-01-27 17:30:06 -08:00
Yann Collet c7611d6964 disable Intel CET Compatibility tests
The binary blob that must be downloaded from intel.com is no longer available
2024-01-27 15:37:29 -08:00
Yann Collet 81f444f4f9 made playTests.sh more compatible with older versions of grep
replaced `\+` by `*`.
`\+` means `[1-N]`,
while `*` means `[0-N]`,
so it's not strictly equivalent
but `\+` happens to be badly supported on some flavors of grep,
and for the purpose of these tests, `*` is good enough.
2024-01-16 12:14:35 -08:00
Yann Collet e6f4b46493 playTests.sh does no longer needs grep -E
it makes the test script more portable across posix systems
because `grep -E` is not guaranteed
while `grep` is fairly common.
2024-01-15 11:16:46 -08:00
Yann Collet 59dcc47579 update license text 2023-11-16 16:19:25 -08:00
Yann Collet 3fd5f9f52d fix the copyright linter 2023-11-13 15:50:42 -08:00
Yann Collet 592b1acb18 update xxhash to v0.8.2
List of updates : https://github.com/Cyan4973/xxHash/releases/tag/v0.8.2

This is also a preparation task before taking care of #3819
2023-11-13 15:42:07 -08:00
Yann Collet 24dabde507 revert to manually defining DTable
thus avoiding the analyzer and ubsan to associate DTable to a size of 1.
2023-10-18 22:45:57 -07:00
Yann Collet d988e00a7f baby-step towards solving flexArray issue #3785
the flexArray in structure FSE_DecompressWksp
is just a way to derive a pointer easily,
without risk/complexity of calculating it manually.

Not sure if this change is good enough to avoid ubsan warnings though.
2023-10-18 16:21:39 -07:00
Yann Collet 3fc14e411b added some documentation on ZSTD_estimate*Size() variants
as a follow up for #3747
2023-09-13 11:35:19 -07:00
Yann Collet 607933a2ff minor simplification for dependency generation
also : fix zstd-nomt exclusion and test
2023-09-12 13:46:03 -07:00
Yann Collet f4dbfce79c define LIB_SRCDIR and LIB_BINDIR 2023-09-12 13:46:03 -07:00
Yann Collet feaa8ac50d renamed STATLIB into STATICLIB
for improved clarity
2023-09-12 13:46:03 -07:00
Yann Collet 4edfaa93b7 default targets of lib/ and programs/ have different names
avoid risks on overlapping in case of include
2023-09-12 13:46:03 -07:00
Yann Collet b69d06a810 add include guards
alleviate risks of double inclusion (typically via transitive includes)
2023-09-12 13:46:03 -07:00
Yann Collet a07d7c4e29 added ZSTD_decompressDCtx() benchmark option to fullbench
useful to compare the difference between ZSTD_decompress
and ZSTD_decompressDCtx().
2023-08-16 10:43:39 -07:00
Yann Collet e4aeaebc20 fixed incorrect test in Win32 pthread wrapper
reported by @Banzai24-yht in #3683
2023-06-20 08:34:26 -07:00
Yann Collet c123e69ad0 fixed static analyzer false positive regarding @sequence initialization
make a mock initialization to please the tool
2023-06-16 16:24:48 -07:00
Yann Collet c60dcedcc9 adapted long decoder to new decodeSequences
removed older decodeSequences
2023-06-16 15:52:00 -07:00
Yann Collet 33fca19dd4 changed ZSTD_decompressSequences_bodySplitLitBuffer() decoding loop
to behave more like the regular decoding loop.
2023-06-16 15:32:07 -07:00
Yann Collet 84e898a76c removed _old variant from splitLit 2023-06-16 14:42:28 -07:00
Yann Collet 02134fad12 changed (partially) the decodeSequences flow logic
this allows detecting overflow events without a checksum.
2023-06-16 11:57:12 -07:00
Yann Collet d9645327b3 fixed MEM_STATIC already defined in Linux Kernel mode 2023-06-14 20:07:18 -07:00
Yann Collet 74c901bbed fix : unused attribute for FORCE_INLINE functions
fix2 : reloadDStreamFast is used by decompress4x2,
modified the entry point, so that it works fine in this case too.
2023-06-14 16:32:51 -07:00
Yann Collet ba50807029 make the bitstream generate only 0-value bits after an overflow 2023-06-14 15:42:37 -07:00
Yann Collet b46236278a detect extraneous bytes in the Sequences section
when nbSeq == 0.

Reported by @ip7z
2023-06-13 11:43:45 -07:00
Yann Collet 3732a08f5b fixed decoder behavior when nbSeqs==0 is encoded using 2 bytes
The sequence section starts with a number, which tells how sequences are present in the section.
If this number if 0, the section automatically ends.

The number 0 can be represented using the 1 byte or the 2 bytes formats.
That's because the 2-bytes formats fully overlaps the 1 byte format.

However, when 0 is represented using the 2-bytes format,
the decoder was expecting the sequence section to continue,
and was looking for FSE tables, which is incorrect.

Fixed this behavior, in both the reference decoder and the educational behavior.

In practice, this behavior never happens,
because the encoder will always select the 1-byte format to represent 0,
since this is more efficient.

Completed the fix with a new golden sample for tests,
a clarification of the specification,
and a decoder errata paragraph.
2023-06-05 16:03:00 -07:00
Yann Collet 1f83b7cfc4 fix a minor inefficiency in compress_superblock
and in `decodecorpus`:
the specific case `nbSeq=127` can be represented using the 1-byte format.
Note that both the 1-byte and the 2-bytes formats are valid to represent this case,
so there was no "error", produced data remains valid,
it's just that the 1-byte format is more efficient.

fix #3667

Credit to @ip7z for finding this issue.
2023-06-05 09:51:52 -07:00
Yann Collet 94a2f2791f changed LLU suffix into ULL for Visual 2012 and lower
both suffixes are supposed to be valid,
but for some reason, Visual 2012 and lower only support ULL.
2023-05-31 13:29:53 -07:00
Yann Collet 5108c9ac97 Fixed a bug in the educational decoder
Credit to Igor Pavlov
2023-05-27 11:22:30 -07:00
Yann Collet 6ec18aed31 minor : update streaming_compression example
display a warning when requesting multi-threading
while linking to a library that doesn't support multi-threading.
2023-04-26 12:45:23 -07:00
Yann Collet 0d6954b4cc added golden file for the new decompressor erratum 2023-04-19 00:24:35 -07:00
Yann Collet 05434fe9a5 removed travis & appveyor scripts
we don't employ these CI systems anymore
2023-04-17 15:50:31 -07:00
Yann Collet a29b6ed251 added decoder errata paragraph
for compressed blocks of size exactly 128 KB
which used to be disallowed by the spec
but have become allowed in more recent version of the spec.

While this limitation is fixed in decoders v1.5.4+,
implementers should refrain from generating such block with their custom encoder
as they could be misclassified as corrupted by older decoder versions.
2023-04-17 15:43:27 -07:00
Yann Collet 8eef3370a3 removed Appveyor Badge
as we don't use Appveyor CI anymore.
2023-04-03 17:40:39 -07:00
Yann Collet e4120c5513 fixing potential over-reads
detected by @terrelln,
these issue could be triggered in specific scenarios
namely decompression of certain invalid magic-less frames,
or requested properties from certain invalid skippable frames.
2023-04-03 16:52:32 -07:00
Yann Collet 2e29728797 fix #3583
As reported by @georgmu,
the previous fix is undone by the later initialization.
Switch order, so that initialization is adjusted by special case.
2023-04-03 09:45:11 -07:00
Yann ColletandYann Collet 9b4833df2d updated changelog
in preparation for v1.5.5
2023-03-31 23:02:08 -07:00
Yann Collet 14d0cd5d69 do not add invocation of UTIL_isRegularFile() 2023-03-31 13:09:52 -07:00
Yann Collet 5bf1359e3b fix decompression with -o writing into a block device
decompression features automatic support of sparse files,
aka a form of "compression" where entire blocks consists only of zeroes.
This only works for some compatible file systems (like ext4),
others simply ignore it (like afs).

Triggering this feature relies of `fseek()`.
But `fseek()` is not compatible with non-seekable devices, such as pipes.
Therefore it's disabled for pipes.

However, there are other objects which are not compatible with `fseek()`, such as block devices.

Changed the logic, so that `fseek()` (and therefore sparse write) is only automatically enabled on regular files.

Note that this automatic behavior can always be overridden by explicit commands `--sparse` and `--no-sparse`.

fix #3583
2023-03-31 11:29:16 -07:00
Yann Collet 35c0c2075e minor doc update on --rsyncable
as requested by @devZer0.
fix #3567
2023-03-23 15:42:27 -06:00
Yann Collet f4563d87b9 added documentation for LDM + dictionary compatibility 2023-03-14 17:17:21 -07:00
Yann Collet dd8cb5a0f1 added documentation for the seekable format
and notably provide additional context for the
Maximum Frame Size parameter.

requested by @P-E-Meunier
at https://github.com/facebook/zstd/commit/1df9f36c6c6cea08778d45a4adaf60e2433439a3#commitcomment-103856979.
2023-03-10 15:54:31 -08:00
Yann Collet 1df9f36c6c Improved seekable format ingestion speed for small frame size
As reported by @P-E-Meunier in https://github.com/facebook/zstd/issues/2662#issuecomment-1443836186,
seekable format ingestion speed can be particularly slow
when selected `FRAME_SIZE` is very small,
especially in combination with the recent row_hash compression mode.
The specific scenario mentioned was `pijul`,
using frame sizes of 256 bytes and level 10.

This is improved in this PR,
by providing approximate parameter adaptation to the compression process.

Tested locally on a M1 laptop,
ingestion of `enwik8` using `pijul` parameters
went from 35sec. (before this PR) to 2.5sec (with this PR).
For the specific corner case of a file full of zeroes,
this is even more pronounced, going from 45sec. to 0.5sec.

These benefits are unrelated to (and come on top of) other improvement efforts currently being made by @yoniko for the row_hash compression method specifically.

The `seekable_compress` test program has been updated to allows setting compression level,
in order to produce these performance results.
2023-03-09 18:00:30 -08:00
Yann Collet 64e8511b26 added clarifications for sizes of compressed huffman blocks and streams. 2023-03-08 15:31:36 -08:00
Yann Collet 1e38e07b3d simplified BMK_benchFilesAdvanced() 2023-03-06 12:34:13 -08:00
Yann Collet 9efc14804e minor: fixed zlib wrapper internal benchmark
another possibility could be to link it to programs/benchfn .
Not worth the effort.
2023-03-06 12:20:06 -08:00
Yann Collet db79219f70 simplify BMK_syntheticTest() 2023-03-06 12:15:22 -08:00
Yann Collet 832f559b0b clarify zstd specification for Huffman blocks
Following detailed comments from @dweiller in #3508.
2023-02-18 18:18:16 -08:00
Yann Collet f8ae21680f try a different compiler 2023-02-10 20:49:21 -08:00
Yann Collet 5be3f19e1d simplify win64 artifact generation 2023-02-10 16:58:54 -08:00
Yann Collet 43bc470fe0 move shell to mingw 2023-02-10 14:27:47 -08:00
Yann Collet f37b291bf5 Github Action to generate Win64 artifacts 2023-02-09 22:48:30 -08:00
Yann Collet 515266e31b minor nit updates to README.md 2023-02-09 15:51:18 -08:00
Yann Collet 4aa3bc49da updated CHANGELOG in preparation for v1.5.4 release 2023-02-08 16:35:55 -08:00
Yann Collet 67fb9d9c77 Merge branch 'dev' of github.com:facebook/zstd into dev 2023-02-08 15:57:12 -08:00
Yann Collet 4de9d637e8 minor: fix missing newline character in help page 2023-02-08 15:56:49 -08:00
Yann Collet c689310b25 rewrite legacy v0.7 bound checks to be independent of address space overflow 2023-02-07 17:11:07 -08:00
Yann ColletandYann Collet 67d7a659f8 port fix for v0.3 to v0.6
in case it would applicable for this version
2023-02-07 13:55:30 -08:00
Yann ColletandYann Collet 7a1a171658 port fix for v0.3 to v0.5
in case it would be applicable for this version too
2023-02-07 13:55:30 -08:00