27 void merge(
unsigned int iters,
size_t maxSize,
size_t bufSize) {
30 std::vector<std::vector<double>> buffers;
36 std::lognormal_distribution<double> distribution(0.0, 1.0);
38 for (
size_t i = 0;
i < iters; ++
i) {
39 std::vector<double>
buffer;
40 for (
size_t j = 0; j < bufSize; ++j) {
41 buffer.push_back(distribution(generator));
43 std::sort(buffer.begin(), buffer.end());
48 for (
const auto&
buffer : buffers) {
53 void mergeDigests(
unsigned int iters,
size_t maxSize,
size_t nDigests) {
54 std::vector<TDigest> digests;
60 std::lognormal_distribution<double> distribution(0.0, 1.0);
62 for (
size_t i = 0;
i < nDigests; ++
i) {
63 std::vector<double>
buffer;
64 for (
size_t j = 0; j < maxSize; ++j) {
65 buffer.push_back(distribution(generator));
67 digests.push_back(digest.
merge(buffer));
71 for (
size_t i = 0;
i < iters; ++
i) {
79 size_t bufSize = maxSize * 10;
81 std::vector<double>
values;
86 std::lognormal_distribution<double> distribution(0.0, 1.0);
88 for (
size_t i = 0;
i < 50000; ++
i) {
89 values.push_back(distribution(generator));
92 for (
size_t i = 0;
i < 50000 / bufSize; ++
i) {
93 std::vector<double>
buffer;
94 for (
size_t j = 0; j < bufSize; ++j) {
95 buffer.push_back(values[
i * bufSize + j]);
97 digest = digest.
merge(buffer);
101 for (
size_t i = 0;
i < iters; ++
i) {
170 gflags::ParseCommandLineFlags(&argc, &
argv,
true);
std::vector< uint8_t > buffer(kBufferSize+16)
void estimateQuantile(unsigned int iters, size_t maxSize, double quantile)
int main(int argc, char *argv[])
std::default_random_engine generator
#define BENCHMARK_SUSPEND
constexpr detail::Map< Move > move
std::chrono::steady_clock::time_point now()
#define BENCHMARK_RELATIVE_NAMED_PARAM(name, param_name,...)
double estimateQuantile(double q) const
void mergeDigests(unsigned int iters, size_t maxSize, size_t nDigests)
#define BENCHMARK_NAMED_PARAM(name, param_name,...)
TDigest merge(presorted_t, Range< const double * > sortedValues) const
constexpr presorted_t presorted
void merge(unsigned int iters, size_t maxSize, size_t bufSize)
std::vector< int > values(1'000)