NageshPatel978 commented on code in PR #55714:
URL: https://github.com/apache/arrow/pull/55714#discussion_r4657768847
##########
cpp/src/parquet/encoding_benchmark.cc:
##########
@@ -729,6 +729,73 @@ static void BM_AlpDecodingDouble(benchmark::State& state) {
}
BENCHMARK(BM_AlpDecodingDouble)->Range(MIN_RANGE, MAX_RANGE);
+// ALP speed depends on how "decimal-like" the data is, so vary the number of
decimals
+// and the share of values that cannot be encoded that way (exceptions).
+template <typename T>
+static std::vector<T> MakeAlpInput(int64_t length, int decimals, int
exception_percent) {
+ std::default_random_engine gen(/*seed=*/42);
+ std::uniform_int_distribution<int64_t> dist_digits(0, 100000);
+ std::uniform_real_distribution<T> dist_random(0, 1000);
+ std::bernoulli_distribution dist_exception(exception_percent / 100.0);
+ const T scale = static_cast<T>(std::pow(10.0, decimals));
+ std::vector<T> values(length);
+ for (auto& v : values) {
+ v = dist_exception(gen) ? dist_random(gen) :
static_cast<T>(dist_digits(gen)) / scale;
Review Comment:
Thanks, that was the cause. Data is now generated as digits * 10^-decimals,
and the float
ratio at 0% exceptions went from ~1.2 to above 1.7.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]