mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-14 10:22:10 +00:00
improve performance
This commit is contained in:
parent
ddba07b9c3
commit
c417f03bdd
@ -46,16 +46,16 @@ public:
|
|||||||
double relative_error_,
|
double relative_error_,
|
||||||
size_t compress_threshold_ = default_compress_threshold,
|
size_t compress_threshold_ = default_compress_threshold,
|
||||||
size_t count_ = 0,
|
size_t count_ = 0,
|
||||||
bool compressed_ = false,
|
bool compressed_ = false)
|
||||||
const std::vector<Stats> & sampled_ = {})
|
|
||||||
: relative_error(relative_error_)
|
: relative_error(relative_error_)
|
||||||
, compress_threshold(compress_threshold_)
|
, compress_threshold(compress_threshold_)
|
||||||
, count(count_)
|
, count(count_)
|
||||||
, compressed(compressed_)
|
, compressed(compressed_)
|
||||||
, sampled(sampled_)
|
|
||||||
{
|
{
|
||||||
sampled.reserve(compress_threshold);
|
sampled.reserve(compress_threshold);
|
||||||
backup_sampled.reserve(compress_threshold);
|
backup_sampled.reserve(compress_threshold);
|
||||||
|
|
||||||
|
head_sampled.reserve(default_head_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isCompressed() const { return compressed; }
|
bool isCompressed() const { return compressed; }
|
||||||
@ -133,9 +133,11 @@ public:
|
|||||||
{
|
{
|
||||||
compress_threshold = other.compress_threshold;
|
compress_threshold = other.compress_threshold;
|
||||||
relative_error = other.relative_error;
|
relative_error = other.relative_error;
|
||||||
sampled = std::move(other.sampled);
|
|
||||||
count = other.count;
|
count = other.count;
|
||||||
compressed = other.compressed;
|
compressed = other.compressed;
|
||||||
|
|
||||||
|
sampled.resize(other.sampled.size());
|
||||||
|
memcpy(sampled.data(), other.sampled.data(), sizeof(Stats) * other.sampled.size());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -383,10 +385,10 @@ private:
|
|||||||
size_t count = 0;
|
size_t count = 0;
|
||||||
bool compressed;
|
bool compressed;
|
||||||
|
|
||||||
std::vector<Stats> sampled;
|
PaddedPODArray<Stats> sampled;
|
||||||
std::vector<Stats> backup_sampled;
|
PaddedPODArray<Stats> backup_sampled;
|
||||||
|
|
||||||
std::vector<T> head_sampled;
|
PaddedPODArray<T> head_sampled;
|
||||||
|
|
||||||
static constexpr size_t default_compress_threshold = 10000;
|
static constexpr size_t default_compress_threshold = 10000;
|
||||||
static constexpr size_t default_head_size = 50000;
|
static constexpr size_t default_head_size = 50000;
|
||||||
|
Loading…
Reference in New Issue
Block a user