]> git.ipfire.org Git - thirdparty/zstd.git/log
thirdparty/zstd.git
7 years ago[fileio] Refuse to remove non-regular file 949/head
Nick Terrell [Wed, 13 Dec 2017 20:04:46 +0000 (12:04 -0800)] 
[fileio] Refuse to remove non-regular file

7 years agofuzzer tests : added -v command
Yann Collet [Wed, 13 Dec 2017 18:08:52 +0000 (10:08 -0800)] 
fuzzer tests : added -v command

so that unit tests get listed in CI console
and we can see which one failed.

7 years agoRevert "Created a test case which reliably reproduces bug #944"
Yann Collet [Tue, 12 Dec 2017 20:51:49 +0000 (12:51 -0800)] 
Revert "Created a test case which reliably reproduces bug #944"

This reverts commit 5098d1fbe2a0b3d0ddb66c0880e3004feac65f3e.

7 years agoCreated a test case which reliably reproduces bug #944
Yann Collet [Tue, 12 Dec 2017 20:48:31 +0000 (12:48 -0800)] 
Created a test case which reliably reproduces bug #944

in zstreamtest.

7 years agoMerge pull request #943 from facebook/fix942
Yann Collet [Fri, 8 Dec 2017 18:53:08 +0000 (13:53 -0500)] 
Merge pull request #943 from facebook/fix942

Fix #942

7 years agocomment clarification 943/head
Yann Collet [Fri, 8 Dec 2017 17:16:49 +0000 (12:16 -0500)] 
comment clarification

7 years agoZSTD_initCStream_srcSize() considers "0" to mean "unknown"
Yann Collet [Thu, 7 Dec 2017 22:13:10 +0000 (17:13 -0500)] 
ZSTD_initCStream_srcSize() considers "0" to mean "unknown"

to not break existing programs relying on this behavior.
Might be changed to mean "empty" in the future.

7 years agozstreamtest : add test which detects when ZSTD_initCStream() inflate data
Yann Collet [Thu, 7 Dec 2017 08:06:01 +0000 (03:06 -0500)] 
zstreamtest : add test which detects when ZSTD_initCStream() inflate data

as in #942, when ZSTD_initCStream() believes data is empty, instead of unknown.

7 years agofix #942 : streaming interface does not compress after ZSTD_initCStream()
Yann Collet [Thu, 7 Dec 2017 07:52:50 +0000 (02:52 -0500)] 
fix #942 : streaming interface does not compress after ZSTD_initCStream()

While the final result is still, technically, a frame,
the resulting frame expands initial data instead of compressing it.
This is because the streaming API creates a tiny 1-byte buffer for input,
because it believes input is empty (0-bytes),
because in the past, 0 used to mean "unknown" instead.

This patch fixes the issue.
Todo : add a test which traps the issue.

7 years agoMerge pull request #941 from facebook/registerLess
Yann Collet [Tue, 5 Dec 2017 15:34:03 +0000 (07:34 -0800)] 
Merge pull request #941 from facebook/registerLess

remove `register` keyword

7 years agoMerge pull request #940 from facebook/gettime
Yann Collet [Tue, 5 Dec 2017 02:21:02 +0000 (18:21 -0800)] 
Merge pull request #940 from facebook/gettime

 fix #911 : changed detection macro for `clock_gettime()`

7 years agono longer supported starting C++17 941/head
Yann Collet [Tue, 5 Dec 2017 01:57:42 +0000 (17:57 -0800)] 
no longer supported starting C++17

7 years agoIt's still necessary to check PLATFORM_POSIX_VERSION for clock_gettime() 940/head
Yann Collet [Tue, 5 Dec 2017 00:31:59 +0000 (16:31 -0800)] 
It's still necessary to check PLATFORM_POSIX_VERSION for clock_gettime()

glibc/uclibc is not enough

7 years agoremoved a few redundant #include
Yann Collet [Tue, 5 Dec 2017 00:02:42 +0000 (16:02 -0800)] 
removed a few redundant #include

7 years agofix #911 : changed detection macro for clock_gettime()
Yann Collet [Mon, 4 Dec 2017 23:57:01 +0000 (15:57 -0800)] 
fix #911 : changed detection macro for clock_gettime()

The new macro might be a bit too restrictive.
Systems which do not support new test will simply default to <time.h>'s `clock_t clock()`,
suffering lesser benchmark accuracy.
Should it matter, the detection macro will have to be upgraded.

7 years agoMerge pull request #936 from facebook/qemu32panic
Yann Collet [Mon, 4 Dec 2017 22:16:55 +0000 (14:16 -0800)] 
Merge pull request #936 from facebook/qemu32panic

Reduce memory stress for qemu tests

7 years agofileio: fixed LZ4F invocation from assert() 936/head
Yann Collet [Mon, 4 Dec 2017 19:26:59 +0000 (11:26 -0800)] 
fileio: fixed LZ4F invocation from assert()

7 years agoMerge branch 'dev' into qemu32panic
Yann Collet [Mon, 4 Dec 2017 19:23:21 +0000 (11:23 -0800)] 
Merge branch 'dev' into qemu32panic

7 years agoMerge pull request #939 from facebook/shorterCircleCI
Yann Collet [Mon, 4 Dec 2017 19:22:30 +0000 (11:22 -0800)] 
Merge pull request #939 from facebook/shorterCircleCI

Faster CircleCI tests

7 years agoMerge branch 'dev' into qemu32panic
Yann Collet [Sun, 3 Dec 2017 19:14:36 +0000 (11:14 -0800)] 
Merge branch 'dev' into qemu32panic

7 years agosetParameter : no side-effect on setting a compression parameter
Yann Collet [Sat, 2 Dec 2017 05:17:09 +0000 (21:17 -0800)] 
setParameter : no side-effect on setting a compression parameter

last such side-effect was modifying cctx->loadedDictEnd on setting forceWindow.
It is no a useless operation, so it's removed.
No side-effect left when setting a compression parameter.

7 years agocircleci: removed -m32 tests 939/head
Yann Collet [Sat, 2 Dec 2017 02:34:22 +0000 (18:34 -0800)] 
circleci: removed -m32 tests

installing dependencies costs ~2mn, making it the longest test
(test itself was < 15sec)

7 years agocircleci : balance some tests
Yann Collet [Sat, 2 Dec 2017 02:11:34 +0000 (18:11 -0800)] 
circleci : balance some tests

try to group them by "equivalent" duration
since next job will not start as long as previous one is not completed on both VM

7 years agocircleci : removed cmaketest
Yann Collet [Sat, 2 Dec 2017 01:56:16 +0000 (17:56 -0800)] 
circleci : removed cmaketest

strange error on pthread detection
(seems a bug in cmake detection, since
`make zstd` works perfectly with `-pthread` on same conf)

7 years agozstdcli: fixed minor warning when bench module not enabled
Yann Collet [Sat, 2 Dec 2017 01:42:46 +0000 (17:42 -0800)] 
zstdcli: fixed minor warning when bench module not enabled

one variable defined but not used

7 years agofixed powerpc test
Yann Collet [Sat, 2 Dec 2017 01:35:19 +0000 (17:35 -0800)] 
fixed powerpc test

misspelled CFLAGS

7 years agocircleci: removed gccX/clang tests
Yann Collet [Sat, 2 Dec 2017 01:28:24 +0000 (17:28 -0800)] 
circleci: removed gccX/clang tests

does no longer need to install these large packages

7 years agoadded environment variable through circleci dashboard
Yann Collet [Sat, 2 Dec 2017 01:22:04 +0000 (17:22 -0800)] 
added environment variable through circleci dashboard

check if it works better

7 years agocircleci: removed one test node
Yann Collet [Sat, 2 Dec 2017 01:02:55 +0000 (17:02 -0800)] 
circleci: removed one test node

7 years agoMerge pull request #938 from terrelln/time
Yann Collet [Sat, 2 Dec 2017 00:40:38 +0000 (16:40 -0800)] 
Merge pull request #938 from terrelln/time

 Use util.h for timing

7 years agoMerge pull request #934 from facebook/opt3
Yann Collet [Sat, 2 Dec 2017 00:40:16 +0000 (16:40 -0800)] 
Merge pull request #934 from facebook/opt3

 zstd_opt: changed cost formula

7 years agocircleci: add CFLAGS=-O0 environment variable
Yann Collet [Sat, 2 Dec 2017 00:31:40 +0000 (16:31 -0800)] 
circleci: add CFLAGS=-O0 environment variable

for faster compilation

7 years agocircleci : make libzstd-nomt had its own test
Yann Collet [Sat, 2 Dec 2017 00:27:24 +0000 (16:27 -0800)] 
circleci : make libzstd-nomt had its own test

7 years agoMerge branch 'dev' into qemu32panic
Yann Collet [Fri, 1 Dec 2017 18:51:01 +0000 (10:51 -0800)] 
Merge branch 'dev' into qemu32panic

7 years agoremoved -ftrapv from tests/ debug flags
Yann Collet [Fri, 1 Dec 2017 18:30:53 +0000 (10:30 -0800)] 
removed -ftrapv from tests/ debug flags

-ftrapv is apparently buggy for gcc.
versions >= 5 are supposed to work better,
but even then, some complaints say it's still flaky when optimizations are enabled.
I even saw a post saying it only works if one creates its own signal handler,
which would make this flag no longer transparent.

on clang, it seems to work correctly.
But we would need to add a method to selectively add flags depending on compiler.
That's too much troubles for the intended benefit
(just catch integer overflows, which we can also do using ubsan).

7 years agoCombine definitions of SEC_TO_MICRO 938/head
Nick Terrell [Fri, 1 Dec 2017 03:40:53 +0000 (19:40 -0800)] 
Combine definitions of SEC_TO_MICRO

7 years agoUse util.h for timing
Nick Terrell [Thu, 30 Nov 2017 03:11:12 +0000 (19:11 -0800)] 
Use util.h for timing

7 years agofixed Visual warning on minor interface discrepancy
Yann Collet [Thu, 30 Nov 2017 01:01:14 +0000 (17:01 -0800)] 
fixed Visual warning on minor interface discrepancy

7 years agoremoved long-range-mode tests from `zstreamtest --no-big-tests`
Yann Collet [Thu, 30 Nov 2017 00:42:20 +0000 (16:42 -0800)] 
removed long-range-mode tests from `zstreamtest --no-big-tests`

7 years agosimplified ZSTD_CCtx_setParametersUsingCCtxParams()
Yann Collet [Thu, 30 Nov 2017 00:13:05 +0000 (16:13 -0800)] 
simplified ZSTD_CCtx_setParametersUsingCCtxParams()

Any ZSTD_CCtx_setParameter() shall just write the requested parameter, without further action.
Any action shall be taken at parameter application only (during init).
It makes it possible to just copy CCtxParams from external container to internal state,
and get rid of the more complex code which was trying to compensate for missing actions.

7 years agozstd_opt: added comments, as requested by @terrelln 934/head
Yann Collet [Wed, 29 Nov 2017 23:19:00 +0000 (15:19 -0800)] 
zstd_opt: added comments, as requested by @terrelln

7 years agoremoved one invocation of SET_PRICE() macro
Yann Collet [Wed, 29 Nov 2017 00:08:43 +0000 (16:08 -0800)] 
removed one invocation of SET_PRICE() macro

7 years agoMerge branch 'dev' into opt3
Yann Collet [Tue, 28 Nov 2017 23:03:58 +0000 (15:03 -0800)] 
Merge branch 'dev' into opt3

7 years agoMerge branch 'dev' of github.com:facebook/zstd into dev
Yann Collet [Tue, 28 Nov 2017 23:03:38 +0000 (15:03 -0800)] 
Merge branch 'dev' of github.com:facebook/zstd into dev

7 years agoadd integer overflow trapping to debug builds
Yann Collet [Tue, 28 Nov 2017 23:02:48 +0000 (15:02 -0800)] 
add integer overflow trapping to debug builds

doc: https://gcc.gnu.org/onlinedocs/gcc-4.0.2/gcc/Code-Gen-Options.html

7 years agozstd_opt: changed cost formula
Yann Collet [Tue, 28 Nov 2017 22:07:03 +0000 (14:07 -0800)] 
zstd_opt: changed cost formula

There was a flaw in the formula
which compared literal cost with match cost :
at a given position,
a non-null literal suite is going to be part of next sequence,
while if position ends a previous match, to immediately start another match,
next sequence will have a litlength of zero.
A litlength of zero has a non-null cost.
It follows that literals cost should be compared to match cost + litlength==0.

Not doing so gave a structural advantage to matches, which would be selected more often.
I believe that's what led to the creation of the strange heuristic which added a complex cost to matches.
The heuristic was actually compensating.
It was probably created through multiple trials, settling for best outcome on a given scenario (I suspect silesia.tar).
The problem with this heuristic is that it's hard to understand,
and unfortunately, any future change in the parser would impact the way it should be calculated and its effects.

The "proper" formula makes it possible to remove this heuristic.

Now, the problem is : in a head to head comparison, it's sometimes better, sometimes worse.
Note that all differences are small (< 0.01 ratio).
In general, the newer formula is better for smaller files (for example, calgary.tar and enwik7).
I suspect that's because starting statistics are pretty poor (another area of improvement).
However, for silesia.tar specifically, it's worse at level 22 (while being better at level 17, so even compression level has an impact ...).

It's a pity that zstd -22 gets worse on silesia.tar.
That being said, I like that the new code gets rid of strange variables,
which were introducing complexity for any future evolution (faster variants being in mind).
Therefore, in spite of this detrimental side effect, I tend to be in favor of it.

7 years agoremoved a bunch of code related to cached literal price
Yann Collet [Tue, 28 Nov 2017 20:32:24 +0000 (12:32 -0800)] 
removed a bunch of code related to cached literal price

optState was used both to evaluate price
and to cache cost of previously calculated literals.
This created a strong dependency, forcing parser to request cost in a strict order.
This limitation is forbids future parser with skipping capabilities.

After this patch, caching literals price still exists,
but is now explicit, in a stack structure.

7 years agoseparate rawLiterals, fullLiterals and match costs
Yann Collet [Tue, 28 Nov 2017 20:14:46 +0000 (12:14 -0800)] 
separate rawLiterals, fullLiterals and match costs

removed one SET_PRICE() macro invocation

7 years agoMerge pull request #893 from felixhandte/fix-lz4-compression-bug
Yann Collet [Tue, 28 Nov 2017 19:34:22 +0000 (11:34 -0800)] 
Merge pull request #893 from felixhandte/fix-lz4-compression-bug

Fix LZ4 Compression Bug

7 years agoFix LZ4 Compression Buffer Overflow 893/head
W. Felix Handte [Tue, 17 Oct 2017 05:19:29 +0000 (01:19 -0400)] 
Fix LZ4 Compression Buffer Overflow

Fixes issue where, when `zstd --format=lz4` is fed an input larger than 128KB,
the read overruns the input buffer. This changes Zstd to use LZ4 with chained
64KB blocks. This is technically a breaking change in that some third party
LZ4 implementations may not support linked blocks. However, progress should not
be allowed to be stopped by such petty concerns as backwards compatibility!

7 years agoAdd Test on LZ4 Format Input Buffer Overrun
W. Felix Handte [Tue, 28 Nov 2017 17:06:48 +0000 (12:06 -0500)] 
Add Test on LZ4 Format Input Buffer Overrun

7 years agobtopt: minor refactor : removed one SET_PRICE() macro invocation
Yann Collet [Tue, 28 Nov 2017 01:13:59 +0000 (17:13 -0800)] 
btopt: minor refactor : removed one SET_PRICE() macro invocation

direct assignment makes operation cleaner.
Also allows some (very minor) optimization (non-measurable)

7 years agobtopt: minor speed optimization
Yann Collet [Tue, 28 Nov 2017 01:01:51 +0000 (17:01 -0800)] 
btopt: minor speed optimization

matchPrice is always right at beginning

7 years agoinstall: changed variable MANDIR into MAN1DIR
Yann Collet [Mon, 27 Nov 2017 21:47:35 +0000 (13:47 -0800)] 
install: changed variable MANDIR into MAN1DIR

MANDIR still exists, and is now the parent of MAN1DIR

7 years agozstreamtest : in `-T#s`, s considered a suffix meaning "seconds"
Yann Collet [Mon, 27 Nov 2017 20:15:23 +0000 (12:15 -0800)] 
zstreamtest : in `-T#s`, s considered a suffix meaning "seconds"

avoid unintentionnally triggering `seedset`,
so that seed gets automatically determined when not set.

7 years agoupdated man page
Yann Collet [Sat, 25 Nov 2017 01:20:54 +0000 (17:20 -0800)] 
updated man page

following patch #931 by @scottchiefbaker

7 years agominor update
Yann Collet [Sat, 25 Nov 2017 00:44:28 +0000 (16:44 -0800)] 
minor update

7 years agoMerge pull request #931 from scottchiefbaker/documentation
Yann Collet [Fri, 24 Nov 2017 08:01:34 +0000 (00:01 -0800)] 
Merge pull request #931 from scottchiefbaker/documentation

Include information about the benchmark output/methodology

7 years agoInclude information about the benchmark output/methodology 931/head
Scott Baker [Thu, 23 Nov 2017 04:29:46 +0000 (20:29 -0800)] 
Include information about the benchmark output/methodology

Addresses #930

7 years agoMerge pull request #924 from facebook/opt2
Yann Collet [Wed, 22 Nov 2017 00:34:37 +0000 (16:34 -0800)] 
Merge pull request #924 from facebook/opt2

faster btopt variant

7 years agofixed comment, reported by @gyscos 924/head
Yann Collet [Tue, 21 Nov 2017 18:36:14 +0000 (10:36 -0800)] 
fixed comment, reported by @gyscos

7 years agofixed comment, as suggested by @terrelln
Yann Collet [Tue, 21 Nov 2017 18:26:17 +0000 (10:26 -0800)] 
fixed comment, as suggested by @terrelln

7 years agoMerge pull request #925 from dusta/patch-1
Yann Collet [Mon, 20 Nov 2017 22:34:03 +0000 (14:34 -0800)] 
Merge pull request #925 from dusta/patch-1

Missing dot

7 years agoMissing dot 925/head
Dusta [Mon, 20 Nov 2017 20:35:28 +0000 (21:35 +0100)] 
Missing dot

7 years agostrategy ZSTD_btopt pinned to (0) variant (faster one)
Yann Collet [Mon, 20 Nov 2017 19:53:20 +0000 (11:53 -0800)] 
strategy ZSTD_btopt pinned to (0) variant (faster one)

7 years agoslightly improved compression speed
Yann Collet [Sun, 19 Nov 2017 22:40:21 +0000 (14:40 -0800)] 
slightly improved compression speed

7 years agoslightly improved ratio at -22
Yann Collet [Sun, 19 Nov 2017 21:39:12 +0000 (13:39 -0800)] 
slightly improved ratio at -22

merging of repcode search into btsearch introduced a small compression ratio regressio at max level :
1.3.2 : 52728769
after repMerge patch : 52760789 (+32020)

A few minor changes have produced this difference.
They can be hard to spot.

This patch buys back about half of the difference,
by no longer inserting position at hc3 when a long match is found there.
It feels strangely counter-intuitive, but works :
after this patch : 52742555 (-18234)

7 years agominor : search early-out on sufficient_len for hc3 and rep
Yann Collet [Sun, 19 Nov 2017 20:58:04 +0000 (12:58 -0800)] 
minor : search early-out on sufficient_len for hc3 and rep

very very small speed and ratio increases

7 years agobtopt0 : a bit faster and weaker
Yann Collet [Sun, 19 Nov 2017 18:38:02 +0000 (10:38 -0800)] 
btopt0 : a bit faster and weaker

7 years agocreated (hidden) new strategy btopt0
Yann Collet [Sun, 19 Nov 2017 18:21:21 +0000 (10:21 -0800)] 
created (hidden) new strategy btopt0

about ~+10% faster but losing ~0.01 compression ratio
(note : amplitude vary a lot depending on files, but direction remains the same)

7 years agozstd_opt: minor speed optimization
Yann Collet [Sun, 19 Nov 2017 00:24:02 +0000 (16:24 -0800)] 
zstd_opt: minor speed optimization

Calculate reference log2sums only once per serie of sequence
(as opposed to once per sequence)

Also: improved code comments

7 years agobench: slightly adjusted display format
Yann Collet [Sat, 18 Nov 2017 23:54:32 +0000 (15:54 -0800)] 
bench: slightly adjusted display format

adapt accuracy depending on value.
makes it possible to have higher accuracy for small value,
notably small compression speed.
This capability is expected to be useful while modifying optimal parser.

7 years agominor spelling fixes
Yann Collet [Sat, 18 Nov 2017 19:28:00 +0000 (11:28 -0800)] 
minor spelling fixes

7 years agofix ZSTD_COMPRESSBOUND() macro
Yann Collet [Sat, 18 Nov 2017 19:16:39 +0000 (11:16 -0800)] 
fix ZSTD_COMPRESSBOUND() macro

It was using macro `KB`, which is not defined in `zstd.h`.

7 years agoMerge pull request #922 from terrelln/signal
Yann Collet [Sat, 18 Nov 2017 02:50:02 +0000 (18:50 -0800)] 
Merge pull request #922 from terrelln/signal

[zstd] Fix rare bug with signal handler

7 years agoMerge pull request #921 from facebook/ubfix
Yann Collet [Sat, 18 Nov 2017 01:11:18 +0000 (17:11 -0800)] 
Merge pull request #921 from facebook/ubfix

Fixes some arithmetic pointer operations

7 years ago[zstd] Fix rare bug with signal handler 922/head
Nick Terrell [Sat, 18 Nov 2017 00:38:56 +0000 (16:38 -0800)] 
[zstd] Fix rare bug with signal handler

7 years agofix un-initialized memory warning 921/head
Yann Collet [Fri, 17 Nov 2017 23:51:52 +0000 (15:51 -0800)] 
fix un-initialized memory warning

harmless, but cleaner

7 years agoMerge pull request #920 from facebook/benchSeparate
Yann Collet [Fri, 17 Nov 2017 21:25:12 +0000 (13:25 -0800)] 
Merge pull request #920 from facebook/benchSeparate

Bench multiple files

7 years agofix one UB pointer arithmetic in encoder
Yann Collet [Fri, 17 Nov 2017 20:55:37 +0000 (12:55 -0800)] 
fix one UB pointer arithmetic in encoder

Instead of calculating distance between 2 memory objects, which is UB,
we extract the offset from object 1, and transfer it into object 2.

7 years agofixed one UB pointer arithmetic
Yann Collet [Fri, 17 Nov 2017 19:40:08 +0000 (11:40 -0800)] 
fixed one UB pointer arithmetic

7 years agoMerge pull request #916 from facebook/optMergeRep
Yann Collet [Fri, 17 Nov 2017 19:29:47 +0000 (11:29 -0800)] 
Merge pull request #916 from facebook/optMergeRep

Optimal parser part 2 : Merge normal and _extDict parsers

7 years agofixed circle-ci script 920/head
Yann Collet [Fri, 17 Nov 2017 10:14:16 +0000 (02:14 -0800)] 
fixed circle-ci script

7 years agominor interface adjustments
Yann Collet [Fri, 17 Nov 2017 09:21:40 +0000 (01:21 -0800)] 
minor interface adjustments

7 years agobench: added cli command `-S` to benchmark multiple files separately
Yann Collet [Fri, 17 Nov 2017 08:22:55 +0000 (00:22 -0800)] 
bench: added cli command `-S` to benchmark multiple files separately

Currently, all files are joined by default,
they are compressed separately but benchmarked together,
providing a single final result.

Benchmarking files separately make it possible to accurately measure difference for each file.
This is expected to be useful while tuning optimal parser.

7 years agobench: realTime is a global parameter
Yann Collet [Fri, 17 Nov 2017 08:02:37 +0000 (00:02 -0800)] 
bench: realTime is a global parameter

like most parameters not directly related to compression

7 years agofixed minor warning 916/head
Yann Collet [Thu, 16 Nov 2017 23:21:30 +0000 (15:21 -0800)] 
fixed minor warning

warning: void function returning a value
(even if the return value is void)

7 years agofixed some complex scenarios
Yann Collet [Thu, 16 Nov 2017 23:02:28 +0000 (15:02 -0800)] 
fixed some complex scenarios

Fixed : multithreading to compress some small data with dictionary
Fixed : ZSTD_initCStream_usingCDict()
Improved streaming memory usage when pledgedSrcSize is known.

7 years agoFixed Btree update
Yann Collet [Thu, 16 Nov 2017 20:18:56 +0000 (12:18 -0800)] 
Fixed Btree update

ZSTD_updateTree() expected to be followed by a Bt match finder, which would update zc->nextToUpdate.
With the new optimal match finder, it's not necessarily the case : a match might be found during repcode or hash3, and stops there because it reaches sufficient_len, without even entering the binary tree.
Previous policy was to nonetheless update zc->nextToUpdate, but the current position would not be inserted, creating "holes" in the btree, aka positions that will no longer be searched.
Now, when current position is not inserted, zc->nextToUpdate is not update, expecting ZSTD_updateTree() to fill the tree later on.

Solution selected is that ZSTD_updateTree() takes care of properly setting zc->nextToUpdate,
so that it no longer depends on a future function to do this job.

It took time to get there, as the issue started with a memory sanitizer error.
The pb would have been easier to spot with a proper `assert()`.
So this patch add a few of them.

Additionnally, I discovered that `make test` does not enable `assert()` during CLI tests.
This patch enables them.

Unfortunately, these `assert()` triggered other (unrelated) bugs during CLI tests, mostly within zstdmt.
So this patch also fixes them.

- Changed packed structure for gcc memory access : memory sanitizer would complain that a read "might" reach out-of-bound position on the ground that the `union` is larger than the type accessed.
  Now, to avoid this issue, each type is independent.
- ZSTD_CCtxParams_setParameter() : @return provides the value of parameter, clamped/fixed appropriately.
- ZSTDMT : changed constant name to ZSTDMT_JOBSIZE_MIN
- ZSTDMT : multithreading is automatically disabled when srcSize <= ZSTDMT_JOBSIZE_MIN, since only one thread will be used in this case (saves memory and runtime).
- ZSTDMT : nbThreads is automatically clamped on setting the value.

7 years agoremoved wrong assertion
Yann Collet [Wed, 15 Nov 2017 23:35:56 +0000 (15:35 -0800)] 
removed wrong assertion

7 years agoremoved a few specialized traces
Yann Collet [Wed, 15 Nov 2017 23:04:53 +0000 (15:04 -0800)] 
removed a few specialized traces

7 years agoshortened repcode match finder implementation
Yann Collet [Wed, 15 Nov 2017 22:37:40 +0000 (14:37 -0800)] 
shortened repcode match finder implementation

7 years agofixed corruption issue
Yann Collet [Wed, 15 Nov 2017 21:44:24 +0000 (13:44 -0800)] 
fixed corruption issue

7 years agostill fighting data corruption
Yann Collet [Wed, 15 Nov 2017 19:29:24 +0000 (11:29 -0800)] 
still fighting data corruption

due to messed up tree.
Seems to happen when reaching end of buffer.

7 years agomerged rep search into btMatchSearch
Yann Collet [Wed, 15 Nov 2017 02:08:17 +0000 (18:08 -0800)] 
merged rep search into btMatchSearch

but there is a tree corruption somewhere ...
bug hunt ongoing

7 years agoMerge pull request #912 from facebook/opt
Yann Collet [Tue, 14 Nov 2017 22:51:24 +0000 (14:51 -0800)] 
Merge pull request #912 from facebook/opt

Optimal parser refactoring

7 years agomerged repcode search into BT match search
Yann Collet [Mon, 13 Nov 2017 10:19:36 +0000 (02:19 -0800)] 
merged repcode search into BT match search

this version has same speed as branch `opt`
which is itself 5-10% slower than branch `dev`
(no identified reason)

It does not compress exactly the same as `opt` or `dev`,
maybe because it doesn't stop search after repcodes,
leading to sometimes better compression, sometimes worse
(by a small margin).

warning : _extDict path does not work for the time being
This means that benchmark module works,
but file module will fail with large files (and high compression level).
Objective is to fuse _extDict path into current one,
in order to have a single parser to maintain.

7 years agocmake: fixed lib/CMakeLists.txt 912/head
Yann Collet [Fri, 10 Nov 2017 17:39:11 +0000 (09:39 -0800)] 
cmake: fixed lib/CMakeLists.txt

changed file name from zstd_compress.h to zstd_compress_internal.h

7 years agoreduced scope of multiple variables
Yann Collet [Thu, 9 Nov 2017 20:46:34 +0000 (12:46 -0800)] 
reduced scope of multiple variables

renamed some variables for better understanding

7 years agolib/compress: created ZSTD_LLcode() and ZSTD_MLcode()
Yann Collet [Wed, 8 Nov 2017 20:33:06 +0000 (12:33 -0800)] 
lib/compress: created ZSTD_LLcode() and ZSTD_MLcode()

transform length into code.
Since transformation is needed in several places throughout the code,
better write the logic in one place.