Add BM_ZFlatAll, BM_ZFlatIncreasingTableSize benchmarks to see how good zippy performs when it is processing different data one after the other.

PiperOrigin-RevId: 257518137
This commit is contained in:
Shahriar Rouf
2019-07-10 17:38:22 -07:00
committed by Victor Costan
parent 156cd8939c
commit 4c7f2d5dfb
3 changed files with 75 additions and 7 deletions

View File

@@ -444,12 +444,14 @@ bool GetUncompressedLength(const char* start, size_t n, size_t* result) {
namespace {
uint32 CalculateTableSize(uint32 input_size) {
assert(kMaxHashTableSize >= 256);
static_assert(
kMaxHashTableSize >= kMinHashTableSize,
"kMaxHashTableSize should be greater or equal to kMinHashTableSize.");
if (input_size > kMaxHashTableSize) {
return kMaxHashTableSize;
}
if (input_size < 256) {
return 256;
if (input_size < kMinHashTableSize) {
return kMinHashTableSize;
}
// This is equivalent to Log2Ceiling(input_size), assuming input_size > 1.
// 2 << Log2Floor(x - 1) is equivalent to 1 << (1 + Log2Floor(x - 1)).