conditional pattern analysis
authorYann Collet <cyan@fb.com>
Fri, 22 Dec 2017 07:07:25 +0000 (08:07 +0100)
committerYann Collet <cyan@fb.com>
Fri, 22 Dec 2017 07:07:25 +0000 (08:07 +0100)
commit9753ac4c91b926114ae636d1d7103dd24e5c0f57
tree84b09d9af6a2d1edc9493ed7fe9e89ac324e3f93
parent8a9c8e73241672c1db29be454a9b8388bfde5034
conditional pattern analysis

Pattern analysis (currently limited to long ranges of identical bytes)
is actually detrimental to performance
when `nbSearches` is low.

Reason is : `nbSearches` provides a built-in protection for these cases.
The problem with patterns is that they dramatically increase the number of candidates to visit.
But with a low nbSearches, the match finder just aborts early.

In such cases, pattern analysis adds some complexity without reducing total nb of candidates.
It actually increases compression ratio a little bit, by filtering only "good" candidates,
but at a measurable speed cost, so it's not a good trade-off.

This patch makes pattern analysis optional.
It's enabled for levels 8+ only.
lib/lz4hc.c
lib/lz4opt.h