You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "mapleFU (via GitHub)" <gi...@apache.org> on 2023/02/24 03:47:47 UTC
[GitHub] [arrow] mapleFU opened a new pull request, #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
mapleFU opened a new pull request, #34323:
URL: https://github.com/apache/arrow/pull/34323
<!--
Thanks for opening a pull request!
If this is your first pull request you can find detailed information on how
to contribute here:
* [New Contributor's Guide](https://arrow.apache.org/docs/dev/developers/guide/step_by_step/pr_lifecycle.html#reviews-and-merge-of-the-pull-request)
* [Contributing Overview](https://arrow.apache.org/docs/dev/developers/overview.html)
If this is not a [minor PR](https://github.com/apache/arrow/blob/main/CONTRIBUTING.md#Minor-Fixes). Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose
Opening GitHub issues ahead of time contributes to the [Openness](http://theapacheway.com/open/#:~:text=Openness%20allows%20new%20users%20the,must%20happen%20in%20the%20open.) of the Apache Arrow project.
Then could you also rename the pull request title in the following format?
GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
or
MINOR: [${COMPONENT}] ${SUMMARY}
In the case of PARQUET issues on JIRA the title also supports:
PARQUET-${JIRA_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
-->
### Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
-->
After https://github.com/apache/arrow/pull/14293 . We have `DELTA_BYTE_LENTH` for encoding ByteArray. So, I'd like to have encoding benchmark for them.
### What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
-->
Benchmark add some cases.
### Are these changes tested?
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
-->
No
### Are there any user-facing changes?
No
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
-->
<!--
If there are any breaking changes to public APIs, please uncomment the line below and explain which changes are breaking.
-->
<!-- **This PR includes breaking changes to public APIs.** -->
<!--
Please uncomment the line below (and provide explanation) if the changes fix either (a) a security vulnerability, (b) a bug that caused incorrect or invalid data to be produced, or (c) a bug that causes a crash (even when the API contract is upheld). We use this to highlight fixes to issues that may affect users without their knowledge. For this reason, fixing bugs that cause errors don't count, since those are usually obvious.
-->
<!-- **This PR contains a "Critical Fix".** -->
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] wgtmac commented on a diff in pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "wgtmac (via GitHub)" <gi...@apache.org>.
wgtmac commented on code in PR #34323:
URL: https://github.com/apache/arrow/pull/34323#discussion_r1119487673
##########
cpp/src/parquet/encoding_benchmark.cc:
##########
@@ -569,6 +569,126 @@ BENCHMARK(BM_DeltaBitPackingDecode_Int64_Narrow)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int32_Wide)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int64_Wide)->Range(MIN_RANGE, MAX_RANGE);
+void EncodingByteArrayBenchmark(benchmark::State& state, Encoding::type encoding) {
+ ::arrow::random::RandomArrayGenerator rag(0);
+ // Using arrow generator to generate random data.
+ int32_t max_length = state.range(0);
+ auto array =
+ rag.String(/* size */ 1024, /* min_length */ 0, /* max_length */ max_length,
Review Comment:
Sometimes we need to adaptively determine a best batch size in the compute engine. Providing different batch sizes may give us better visibility on the encoding side. I suspect it will demonstrate a linear behavior as it has barriers including the block size or encoding pattern. @rok
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] mapleFU commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1447880461
I guess:
1. for plain encoder: When string is short and batch is small, memory bandwidth cannot be full-used. When memory bindwidth can be make full used off, the speed is about 3GB/s. When the string grows larger, the bottleneck may goes to "resize"
2. for plain decoder: The speed is nearly unrelated to size of bytes, it's scalable.
3. For DeltaBitLength Encoder: when string are short, this is slower. But when string is long, seems that it's ok. Maybe because some optimizations.
4. For DeltaBitLength Decoder: so slow, I'll fix it in another patch using zero-copy.
5. For Dict decoder: Because it need to decode the dict page, seems dict and memcpy is still used. Maybe I can optimize it later
@wgtmac @rok
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] mapleFU commented on a diff in pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on code in PR #34323:
URL: https://github.com/apache/arrow/pull/34323#discussion_r1128374631
##########
cpp/src/parquet/encoding_benchmark.cc:
##########
@@ -569,6 +569,130 @@ BENCHMARK(BM_DeltaBitPackingDecode_Int64_Narrow)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int32_Wide)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int64_Wide)->Range(MIN_RANGE, MAX_RANGE);
+static void ByteArrayCustomArguments(benchmark::internal::Benchmark* b) {
+ b->ArgsProduct({{8, 64, 1024}, {512, 2048}})
+ ->ArgNames({"max-string-length", "batch-size"});
+}
+
+void EncodingByteArrayBenchmark(benchmark::State& state, Encoding::type encoding) {
+ ::arrow::random::RandomArrayGenerator rag(0);
+ // Using arrow generator to generate random data.
+ int32_t max_length = static_cast<int32_t>(state.range(0));
+ int32_t array_size = static_cast<int32_t>(state.range(1));
+ auto array =
+ rag.String(/* size */ array_size, /* min_length */ 0, /* max_length */ max_length,
+ /* null_probability */ 0);
+ const auto array_actual =
+ ::arrow::internal::checked_pointer_cast<::arrow::StringArray>(array);
+ auto encoder = MakeTypedEncoder<ByteArrayType>(encoding);
+ std::vector<ByteArray> values;
+ for (int i = 0; i < array_actual->length(); ++i) {
+ values.emplace_back(array_actual->GetView(i));
+ }
+
+ for (auto _ : state) {
+ encoder->Put(values.data(), static_cast<int>(values.size()));
+ encoder->FlushValues();
+ }
+ state.SetItemsProcessed(state.iterations() * array_actual->length());
+ state.SetBytesProcessed(state.iterations() * array_actual->total_values_length());
+}
+
+static void BM_DeltaLengthEncodingByteArray(benchmark::State& state) {
+ EncodingByteArrayBenchmark(state, Encoding::DELTA_LENGTH_BYTE_ARRAY);
+}
+
+static void BM_PlainEncodingByteArray(benchmark::State& state) {
+ EncodingByteArrayBenchmark(state, Encoding::PLAIN);
+}
+
+void DecodingByteArrayBenchmark(benchmark::State& state, Encoding::type encoding) {
+ ::arrow::random::RandomArrayGenerator rag(0);
+ int32_t max_length = static_cast<int32_t>(state.range(0));
+ int32_t array_size = static_cast<int32_t>(state.range(1));
+ // Using arrow to write, because we just benchmark decoding here.
+ auto array =
+ rag.String(/* size */ array_size, /* min_length */ 0, /* max_length */ max_length,
+ /* null_probability */ 0);
+ const auto array_actual =
+ ::arrow::internal::checked_pointer_cast<::arrow::StringArray>(array);
+ auto encoder = MakeTypedEncoder<ByteArrayType>(encoding);
+ encoder->Put(*array);
+ std::shared_ptr<Buffer> buf = encoder->FlushValues();
+
+ std::vector<ByteArray> values;
+ values.resize(array->length());
+ for (auto _ : state) {
+ auto decoder = MakeTypedDecoder<ByteArrayType>(encoding);
+ decoder->SetData(static_cast<int>(array->length()), buf->data(),
+ static_cast<int>(buf->size()));
+ decoder->Decode(values.data(), static_cast<int>(values.size()));
+ ::benchmark::DoNotOptimize(values);
+ }
+ state.SetItemsProcessed(state.iterations() * array->length());
+ state.SetBytesProcessed(state.iterations() * array_actual->total_values_length());
+}
+
+static void BM_PlainDecodingByteArray(benchmark::State& state) {
+ DecodingByteArrayBenchmark(state, Encoding::PLAIN);
+}
+
+static void BM_DeltaLengthDecodingByteArray(benchmark::State& state) {
+ DecodingByteArrayBenchmark(state, Encoding::DELTA_LENGTH_BYTE_ARRAY);
+}
+
+BENCHMARK(BM_PlainEncodingByteArray)->Apply(ByteArrayCustomArguments);
+BENCHMARK(BM_DeltaLengthEncodingByteArray)->Apply(ByteArrayCustomArguments);
+BENCHMARK(BM_PlainDecodingByteArray)->Apply(ByteArrayCustomArguments);
+BENCHMARK(BM_DeltaLengthDecodingByteArray)->Apply(ByteArrayCustomArguments);
+
+static void BM_DecodingByteArraySpaced(benchmark::State& state, Encoding::type encoding) {
+ const double null_percent = 0.02;
+
+ auto rand = ::arrow::random::RandomArrayGenerator(0);
+ int32_t max_length = static_cast<int32_t>(state.range(0));
+ int32_t num_values = static_cast<int32_t>(state.range(1));
+ const auto array = rand.String(num_values, /* min_length */ 0,
+ /* max_length */ max_length, null_percent);
+ const auto valid_bits = array->null_bitmap_data();
+ const int null_count = static_cast<int>(array->null_count());
+ const auto array_actual =
+ ::arrow::internal::checked_pointer_cast<::arrow::StringArray>(array);
+
+ std::vector<ByteArray> byte_arrays;
+ byte_arrays.reserve(array_actual->length());
+ for (int i = 0; i < array_actual->length(); ++i) {
+ byte_arrays.emplace_back(array_actual->GetView(i));
+ }
+
+ auto encoder = MakeTypedEncoder<ByteArrayType>(encoding);
+ encoder->PutSpaced(byte_arrays.data(), num_values, valid_bits, 0);
+ std::shared_ptr<Buffer> buf = encoder->FlushValues();
+
+ auto decoder = MakeTypedDecoder<ByteArrayType>(encoding);
+ std::vector<uint8_t> decode_values(num_values * sizeof(ByteArray));
+ auto decode_buf = reinterpret_cast<ByteArray*>(decode_values.data());
+ for (auto _ : state) {
+ decoder->SetData(num_values - null_count, buf->data(), static_cast<int>(buf->size()));
+ decoder->DecodeSpaced(decode_buf, num_values, null_count, valid_bits, 0);
+ ::benchmark::DoNotOptimize(decode_buf);
+ }
+ state.counters["null_percent"] = null_percent * 100;
+ state.SetItemsProcessed(state.iterations() * array_actual->length());
+ state.SetBytesProcessed(state.iterations() * array_actual->total_values_length());
Review Comment:
Sure, I can unify it, wait a minute
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] ursabot commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "ursabot (via GitHub)" <gi...@apache.org>.
ursabot commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1460668602
Benchmark runs are scheduled for baseline = bd8005151cac0470474c0c65b6a9299f2c0bde83 and contender = 22f2980e9ba5de684c51d6e92a74d449cb405e3d. 22f2980e9ba5de684c51d6e92a74d449cb405e3d is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Finished :arrow_down:0.0% :arrow_up:0.0%] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/ac23976006444f01bba7a96dbb0ccc55...1440275a92f641c896413aab96f260f1/)
[Failed :arrow_down:1.45% :arrow_up:0.06%] [test-mac-arm](https://conbench.ursa.dev/compare/runs/a932b1867caf4ef49777b77efb8820cd...39a6b4bee16b40d799b5788b3abe96d3/)
[Finished :arrow_down:0.26% :arrow_up:0.0%] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/ae9c0cf1b0de47d6a9ceda0cf1a03ac4...228b57998af24c8888a73437eca6a150/)
[Finished :arrow_down:0.25% :arrow_up:0.28%] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/c2972e7bb8934a3d9c09363c664c44d4...2aa85e2d695f41af8627636a7d79a172/)
Buildkite builds:
[Finished] [`22f2980e` ec2-t3-xlarge-us-east-2](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ec2-t3-xlarge-us-east-2/builds/2493)
[Failed] [`22f2980e` test-mac-arm](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-test-mac-arm/builds/2523)
[Finished] [`22f2980e` ursa-i9-9960x](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-i9-9960x/builds/2491)
[Finished] [`22f2980e` ursa-thinkcentre-m75q](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-thinkcentre-m75q/builds/2514)
[Finished] [`bd800515` ec2-t3-xlarge-us-east-2](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ec2-t3-xlarge-us-east-2/builds/2492)
[Failed] [`bd800515` test-mac-arm](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-test-mac-arm/builds/2522)
[Finished] [`bd800515` ursa-i9-9960x](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-i9-9960x/builds/2490)
[Finished] [`bd800515` ursa-thinkcentre-m75q](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-thinkcentre-m75q/builds/2513)
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] rok commented on a diff in pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "rok (via GitHub)" <gi...@apache.org>.
rok commented on code in PR #34323:
URL: https://github.com/apache/arrow/pull/34323#discussion_r1128331744
##########
cpp/src/parquet/encoding_benchmark.cc:
##########
@@ -569,6 +569,130 @@ BENCHMARK(BM_DeltaBitPackingDecode_Int64_Narrow)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int32_Wide)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int64_Wide)->Range(MIN_RANGE, MAX_RANGE);
+static void ByteArrayCustomArguments(benchmark::internal::Benchmark* b) {
+ b->ArgsProduct({{8, 64, 1024}, {512, 2048}})
+ ->ArgNames({"max-string-length", "batch-size"});
+}
+
+void EncodingByteArrayBenchmark(benchmark::State& state, Encoding::type encoding) {
+ ::arrow::random::RandomArrayGenerator rag(0);
+ // Using arrow generator to generate random data.
+ int32_t max_length = static_cast<int32_t>(state.range(0));
+ int32_t array_size = static_cast<int32_t>(state.range(1));
+ auto array =
+ rag.String(/* size */ array_size, /* min_length */ 0, /* max_length */ max_length,
+ /* null_probability */ 0);
+ const auto array_actual =
+ ::arrow::internal::checked_pointer_cast<::arrow::StringArray>(array);
+ auto encoder = MakeTypedEncoder<ByteArrayType>(encoding);
+ std::vector<ByteArray> values;
+ for (int i = 0; i < array_actual->length(); ++i) {
+ values.emplace_back(array_actual->GetView(i));
+ }
+
+ for (auto _ : state) {
+ encoder->Put(values.data(), static_cast<int>(values.size()));
+ encoder->FlushValues();
+ }
+ state.SetItemsProcessed(state.iterations() * array_actual->length());
+ state.SetBytesProcessed(state.iterations() * array_actual->total_values_length());
+}
+
+static void BM_DeltaLengthEncodingByteArray(benchmark::State& state) {
+ EncodingByteArrayBenchmark(state, Encoding::DELTA_LENGTH_BYTE_ARRAY);
+}
+
+static void BM_PlainEncodingByteArray(benchmark::State& state) {
+ EncodingByteArrayBenchmark(state, Encoding::PLAIN);
+}
+
+void DecodingByteArrayBenchmark(benchmark::State& state, Encoding::type encoding) {
+ ::arrow::random::RandomArrayGenerator rag(0);
+ int32_t max_length = static_cast<int32_t>(state.range(0));
+ int32_t array_size = static_cast<int32_t>(state.range(1));
+ // Using arrow to write, because we just benchmark decoding here.
+ auto array =
+ rag.String(/* size */ array_size, /* min_length */ 0, /* max_length */ max_length,
+ /* null_probability */ 0);
+ const auto array_actual =
+ ::arrow::internal::checked_pointer_cast<::arrow::StringArray>(array);
+ auto encoder = MakeTypedEncoder<ByteArrayType>(encoding);
+ encoder->Put(*array);
+ std::shared_ptr<Buffer> buf = encoder->FlushValues();
+
+ std::vector<ByteArray> values;
+ values.resize(array->length());
+ for (auto _ : state) {
+ auto decoder = MakeTypedDecoder<ByteArrayType>(encoding);
+ decoder->SetData(static_cast<int>(array->length()), buf->data(),
+ static_cast<int>(buf->size()));
+ decoder->Decode(values.data(), static_cast<int>(values.size()));
+ ::benchmark::DoNotOptimize(values);
+ }
+ state.SetItemsProcessed(state.iterations() * array->length());
Review Comment:
Should this be:
```suggestion
state.SetItemsProcessed(state.iterations() * array_actual->length());
```
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] ursabot commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "ursabot (via GitHub)" <gi...@apache.org>.
ursabot commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1468874196
['Python', 'R'] benchmarks have high level of regressions.
[test-mac-arm](https://conbench.ursa.dev/compare/runs/a932b1867caf4ef49777b77efb8820cd...39a6b4bee16b40d799b5788b3abe96d3/)
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] mapleFU commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1443233850
I'll test it on my mac and PC tonight :)
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] mapleFU commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1443865206
To be honest, I found that decoding DELTA_LENGTH_BYTE_ARRAY is much more slower than I expected...
After some trivial optimization on Decoder, the speed between them are equal. The previous impl is too slow
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] wgtmac commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "wgtmac (via GitHub)" <gi...@apache.org>.
wgtmac commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1449174744
> Optimizations would be great but let's track them in separate issues and use ursabot commands (listed here https://ursalabs.org/blog/announcing-conbench/). This looks good to me.
Good to know we have the command in hand!
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] pitrou commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1448237100
Thanks for the update @mapleFU . For the record, here are the results here (AMD Ryzen 3900X):
```
------------------------------------------------------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations UserCounters...
------------------------------------------------------------------------------------------------------------------------------------------
BM_PlainEncodingByteArray/max-string-length:8/batch-size:512 12594 ns 12593 ns 55779 byte_array_bytes=113.789M items_per_second=40.6586M/s
BM_PlainEncodingByteArray/max-string-length:64/batch-size:512 14420 ns 14417 ns 48331 byte_array_bytes=793.305M items_per_second=35.5148M/s
BM_PlainEncodingByteArray/max-string-length:1024/batch-size:512 28398 ns 28391 ns 25410 byte_array_bytes=6.6688G items_per_second=18.0338M/s
BM_PlainEncodingByteArray/max-string-length:8/batch-size:2048 41884 ns 41876 ns 16661 byte_array_bytes=135.671M items_per_second=48.9058M/s
BM_PlainEncodingByteArray/max-string-length:64/batch-size:2048 44265 ns 44256 ns 15969 byte_array_bytes=1043.1M items_per_second=46.2757M/s
BM_PlainEncodingByteArray/max-string-length:1024/batch-size:2048 86621 ns 86603 ns 8050 byte_array_bytes=8.41448G items_per_second=23.6482M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:8/batch-size:512 32244 ns 32238 ns 21688 byte_array_bytes=44.2435M items_per_second=15.8817M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:64/batch-size:512 34539 ns 34531 ns 20295 byte_array_bytes=333.122M items_per_second=14.8271M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:1024/batch-size:512 45766 ns 45757 ns 15279 byte_array_bytes=4.00994G items_per_second=11.1896M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:8/batch-size:2048 109565 ns 109541 ns 6348 byte_array_bytes=51.6918M items_per_second=18.6961M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:64/batch-size:2048 114663 ns 114642 ns 6067 byte_array_bytes=396.296M items_per_second=17.8643M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:1024/batch-size:2048 160417 ns 160380 ns 4360 byte_array_bytes=4.55741G items_per_second=12.7697M/s
BM_PlainDecodingByteArray/max-string-length:8/batch-size:512 4858 ns 4857 ns 144004 byte_array_bytes=293.768M items_per_second=105.417M/s
BM_PlainDecodingByteArray/max-string-length:64/batch-size:512 4866 ns 4865 ns 143752 byte_array_bytes=2.35955G items_per_second=105.232M/s
BM_PlainDecodingByteArray/max-string-length:1024/batch-size:512 5001 ns 5001 ns 100000 byte_array_bytes=26.2448G items_per_second=102.382M/s
BM_PlainDecodingByteArray/max-string-length:8/batch-size:2048 18209 ns 18206 ns 38436 byte_array_bytes=312.984M items_per_second=112.491M/s
BM_PlainDecodingByteArray/max-string-length:64/batch-size:2048 18233 ns 18230 ns 38397 byte_array_bytes=2.50809G items_per_second=112.343M/s
BM_PlainDecodingByteArray/max-string-length:1024/batch-size:2048 20200 ns 20197 ns 34499 byte_array_bytes=36.061G items_per_second=101.4M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:8/batch-size:512 41635 ns 41627 ns 16834 byte_array_bytes=34.3414M items_per_second=12.2996M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:64/batch-size:512 239903 ns 239849 ns 2915 byte_array_bytes=47.8468M items_per_second=2.13468M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:1024/batch-size:512 3622032 ns 3621400 ns 193 byte_array_bytes=50.6525M items_per_second=141.382k/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:8/batch-size:2048 146493 ns 146468 ns 4760 byte_array_bytes=38.7607M items_per_second=13.9826M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:64/batch-size:2048 933696 ns 933526 ns 745 byte_array_bytes=48.6634M items_per_second=2.19383M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:1024/batch-size:2048 14409849 ns 14407405 ns 49 byte_array_bytes=51.2186M items_per_second=142.149k/s
BM_PlainDecodingSpacedByteArray/max-string-length:8/batch-size:512 4846 ns 4845 ns 144521 byte_array_bytes=289.765M items_per_second=105.677M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:64/batch-size:512 4846 ns 4846 ns 144301 byte_array_bytes=2.32859G items_per_second=105.658M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:1024/batch-size:512 4978 ns 4977 ns 140527 byte_array_bytes=36.2544G items_per_second=102.864M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:8/batch-size:2048 19194 ns 19192 ns 36455 byte_array_bytes=290.765M items_per_second=106.711M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:64/batch-size:2048 19621 ns 19618 ns 36211 byte_array_bytes=2.317G items_per_second=104.395M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:1024/batch-size:2048 21938 ns 21936 ns 32246 byte_array_bytes=33.0161G items_per_second=93.3639M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:8/batch-size:512 37893 ns 37885 ns 18469 byte_array_bytes=37.0303M items_per_second=13.5144M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:64/batch-size:512 233946 ns 233912 ns 2989 byte_array_bytes=48.2335M items_per_second=2.18886M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:1024/batch-size:512 3587274 ns 3586596 ns 195 byte_array_bytes=50.3079M items_per_second=142.754k/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:8/batch-size:2048 142456 ns 142435 ns 4889 byte_array_bytes=38.9947M items_per_second=14.3785M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:64/batch-size:2048 920207 ns 920040 ns 745 byte_array_bytes=47.6696M items_per_second=2.22599M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:1024/batch-size:2048 14224939 ns 14222911 ns 49 byte_array_bytes=50.1702M items_per_second=143.993k/s null_percent=2
BM_DictDecodingByteArray/max-string-length:8/batch-size:512 22734 ns 22729 ns 30588 bytes_per_second=5.37059M/s
BM_DictDecodingByteArray/max-string-length:64/batch-size:512 25422 ns 25416 ns 27513 bytes_per_second=38.4226M/s
BM_DictDecodingByteArray/max-string-length:1024/batch-size:512 32993 ns 32986 ns 21277 bytes_per_second=473.691M/s
BM_DictDecodingByteArray/max-string-length:8/batch-size:2048 68025 ns 68011 ns 10276 bytes_per_second=1.79487M/s
BM_DictDecodingByteArray/max-string-length:64/batch-size:2048 77163 ns 77147 ns 9060 bytes_per_second=12.6584M/s
BM_DictDecodingByteArray/max-string-length:1024/batch-size:2048 112020 ns 111995 ns 6238 bytes_per_second=139.515M/s
```
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] rok commented on a diff in pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "rok (via GitHub)" <gi...@apache.org>.
rok commented on code in PR #34323:
URL: https://github.com/apache/arrow/pull/34323#discussion_r1119458579
##########
cpp/src/parquet/encoding_benchmark.cc:
##########
@@ -569,6 +569,126 @@ BENCHMARK(BM_DeltaBitPackingDecode_Int64_Narrow)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int32_Wide)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int64_Wide)->Range(MIN_RANGE, MAX_RANGE);
+void EncodingByteArrayBenchmark(benchmark::State& state, Encoding::type encoding) {
+ ::arrow::random::RandomArrayGenerator rag(0);
+ // Using arrow generator to generate random data.
+ int32_t max_length = state.range(0);
Review Comment:
This appears to be implicit casting and causes [CI to complain](https://github.com/apache/arrow/actions/runs/4275778292/jobs/7443378150#step:11:1503).
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] pitrou commented on a diff in pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on code in PR #34323:
URL: https://github.com/apache/arrow/pull/34323#discussion_r1120119076
##########
cpp/src/parquet/encoding_benchmark.cc:
##########
@@ -569,6 +569,133 @@ BENCHMARK(BM_DeltaBitPackingDecode_Int64_Narrow)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int32_Wide)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int64_Wide)->Range(MIN_RANGE, MAX_RANGE);
+static void ByteArrayCustomArguments(benchmark::internal::Benchmark* b) {
+ b->ArgsProduct({{8, 64, 1024}, {512, 2048}})
+ ->ArgNames({"max-string-length", "batch-size"});
+}
+
+void EncodingByteArrayBenchmark(benchmark::State& state, Encoding::type encoding) {
+ ::arrow::random::RandomArrayGenerator rag(0);
+ // Using arrow generator to generate random data.
+ int32_t max_length = static_cast<int32_t>(state.range(0));
+ int32_t array_size = static_cast<int32_t>(state.range(1));
+ auto array =
+ rag.String(/* size */ array_size, /* min_length */ 0, /* max_length */ max_length,
+ /* null_probability */ 0);
+ const auto array_actual =
+ ::arrow::internal::checked_pointer_cast<::arrow::StringArray>(array);
+ auto encoder = MakeTypedEncoder<ByteArrayType>(encoding);
+ std::vector<ByteArray> values;
+ for (int i = 0; i < array_actual->length(); ++i) {
+ values.emplace_back(array_actual->GetView(i));
+ }
+
+ for (auto _ : state) {
+ encoder->Put(values.data(), static_cast<int>(values.size()));
+ encoder->FlushValues();
+ }
+ state.SetItemsProcessed(state.iterations() * array_actual->length());
+ state.counters["byte_array_bytes"] =
+ static_cast<double>(state.iterations() * array_actual->total_values_length());
+}
+
+static void BM_DeltaBitLengthEncodingByteArray(benchmark::State& state) {
+ EncodingByteArrayBenchmark(state, Encoding::DELTA_LENGTH_BYTE_ARRAY);
+}
+
+static void BM_PlainEncodingByteArray(benchmark::State& state) {
+ EncodingByteArrayBenchmark(state, Encoding::PLAIN);
+}
+
+void DecodingByteArrayBenchmark(benchmark::State& state, Encoding::type encoding) {
+ ::arrow::random::RandomArrayGenerator rag(0);
+ int32_t max_length = static_cast<int32_t>(state.range(0));
+ int32_t array_size = static_cast<int32_t>(state.range(1));
+ // Using arrow to write, because we just benchmark decoding here.
+ auto array =
+ rag.String(/* size */ array_size, /* min_length */ 0, /* max_length */ max_length,
+ /* null_probability */ 0);
+ const auto array_actual =
+ ::arrow::internal::checked_pointer_cast<::arrow::StringArray>(array);
+ auto encoder = MakeTypedEncoder<ByteArrayType>(encoding);
+ encoder->Put(*array);
+ std::shared_ptr<Buffer> buf = encoder->FlushValues();
+
+ std::vector<ByteArray> values;
+ values.resize(array->length());
+ for (auto _ : state) {
+ auto decoder = MakeTypedDecoder<ByteArrayType>(encoding);
+ decoder->SetData(static_cast<int>(array->length()), buf->data(),
+ static_cast<int>(buf->size()));
+ decoder->Decode(values.data(), static_cast<int>(values.size()));
+ ::benchmark::DoNotOptimize(values);
+ }
+ state.SetItemsProcessed(state.iterations() * array->length());
+ state.counters["byte_array_bytes"] =
+ static_cast<double>(state.iterations() * array_actual->total_values_length());
+}
+
+static void BM_PlainDecodingByteArray(benchmark::State& state) {
+ DecodingByteArrayBenchmark(state, Encoding::PLAIN);
+}
+
+static void BM_DeltaBitLengthDecodingByteArray(benchmark::State& state) {
+ DecodingByteArrayBenchmark(state, Encoding::DELTA_LENGTH_BYTE_ARRAY);
+}
+
+BENCHMARK(BM_PlainEncodingByteArray)->Apply(ByteArrayCustomArguments);
+BENCHMARK(BM_DeltaBitLengthEncodingByteArray)->Apply(ByteArrayCustomArguments);
+BENCHMARK(BM_PlainDecodingByteArray)->Apply(ByteArrayCustomArguments);
+BENCHMARK(BM_DeltaBitLengthDecodingByteArray)->Apply(ByteArrayCustomArguments);
+
+static void BM_DecodingByteArraySpaced(benchmark::State& state, Encoding::type encoding) {
+ const double null_percent = 0.02;
+
+ auto rand = ::arrow::random::RandomArrayGenerator(0);
+ int32_t max_length = static_cast<int32_t>(state.range(0));
+ int32_t num_values = static_cast<int32_t>(state.range(1));
+ const auto array = rand.String(num_values, /* min_length */ 0,
+ /* max_length */ max_length, null_percent);
+ const auto valid_bits = array->null_bitmap_data();
+ const int null_count = static_cast<int>(array->null_count());
+ const auto array_actual =
+ ::arrow::internal::checked_pointer_cast<::arrow::StringArray>(array);
+
+ std::vector<ByteArray> byte_arrays;
+ byte_arrays.reserve(array_actual->length());
+ for (int i = 0; i < array_actual->length(); ++i) {
+ byte_arrays.emplace_back(array_actual->GetView(i));
+ }
+
+ auto encoder = MakeTypedEncoder<ByteArrayType>(encoding);
+ encoder->PutSpaced(byte_arrays.data(), num_values, valid_bits, 0);
+ std::shared_ptr<Buffer> buf = encoder->FlushValues();
+
+ auto decoder = MakeTypedDecoder<ByteArrayType>(encoding);
+ std::vector<uint8_t> decode_values(num_values * sizeof(ByteArray));
+ auto decode_buf = reinterpret_cast<ByteArray*>(decode_values.data());
+ for (auto _ : state) {
+ decoder->SetData(num_values - null_count, buf->data(), static_cast<int>(buf->size()));
+ decoder->DecodeSpaced(decode_buf, num_values, null_count, valid_bits, 0);
+ ::benchmark::DoNotOptimize(decode_buf);
+ }
+ state.counters["null_percent"] = null_percent * 100;
+ state.SetItemsProcessed(state.iterations() * array_actual->length());
+ state.counters["byte_array_bytes"] =
+ static_cast<double>(state.iterations() * array_actual->total_values_length());
Review Comment:
Same here.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] rok commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "rok (via GitHub)" <gi...@apache.org>.
rok commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1443258103
This looks pretty good.
Do you think it would make sense to add a benchmark with some nulls?
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] mapleFU commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1448487622
I've test it here: https://github.com/apache/arrow/pull/34323#issuecomment-1444041796
Let us do it patch by patch and make this benchmark merged first.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] rok commented on a diff in pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "rok (via GitHub)" <gi...@apache.org>.
rok commented on code in PR #34323:
URL: https://github.com/apache/arrow/pull/34323#discussion_r1120917311
##########
cpp/src/parquet/encoding_benchmark.cc:
##########
@@ -569,6 +569,126 @@ BENCHMARK(BM_DeltaBitPackingDecode_Int64_Narrow)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int32_Wide)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int64_Wide)->Range(MIN_RANGE, MAX_RANGE);
+void EncodingByteArrayBenchmark(benchmark::State& state, Encoding::type encoding) {
+ ::arrow::random::RandomArrayGenerator rag(0);
+ // Using arrow generator to generate random data.
+ int32_t max_length = state.range(0);
+ auto array =
+ rag.String(/* size */ 1024, /* min_length */ 0, /* max_length */ max_length,
Review Comment:
But how many do we need to catch performance regressions?
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] mapleFU commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1448397076
<img width="925" alt="2685B9FE-5C6F-4959-8E87-0AEB7DF3D138" src="https://user-images.githubusercontent.com/24351052/221901798-2401e869-9c25-4dac-8ece-43429d55a6e9.png">
It Spend lots of time on unpack, because it use `BitReader` and fetch bytes from bit-reader, which is a huge waste of time @pitrou
So it's still expected
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] wjones127 merged pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "wjones127 (via GitHub)" <gi...@apache.org>.
wjones127 merged PR #34323:
URL: https://github.com/apache/arrow/pull/34323
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] pitrou commented on a diff in pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on code in PR #34323:
URL: https://github.com/apache/arrow/pull/34323#discussion_r1120117733
##########
cpp/src/parquet/encoding_benchmark.cc:
##########
@@ -569,6 +569,133 @@ BENCHMARK(BM_DeltaBitPackingDecode_Int64_Narrow)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int32_Wide)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int64_Wide)->Range(MIN_RANGE, MAX_RANGE);
+static void ByteArrayCustomArguments(benchmark::internal::Benchmark* b) {
+ b->ArgsProduct({{8, 64, 1024}, {512, 2048}})
+ ->ArgNames({"max-string-length", "batch-size"});
+}
+
+void EncodingByteArrayBenchmark(benchmark::State& state, Encoding::type encoding) {
+ ::arrow::random::RandomArrayGenerator rag(0);
+ // Using arrow generator to generate random data.
+ int32_t max_length = static_cast<int32_t>(state.range(0));
+ int32_t array_size = static_cast<int32_t>(state.range(1));
+ auto array =
+ rag.String(/* size */ array_size, /* min_length */ 0, /* max_length */ max_length,
+ /* null_probability */ 0);
+ const auto array_actual =
+ ::arrow::internal::checked_pointer_cast<::arrow::StringArray>(array);
+ auto encoder = MakeTypedEncoder<ByteArrayType>(encoding);
+ std::vector<ByteArray> values;
+ for (int i = 0; i < array_actual->length(); ++i) {
+ values.emplace_back(array_actual->GetView(i));
+ }
+
+ for (auto _ : state) {
+ encoder->Put(values.data(), static_cast<int>(values.size()));
+ encoder->FlushValues();
+ }
+ state.SetItemsProcessed(state.iterations() * array_actual->length());
+ state.counters["byte_array_bytes"] =
+ static_cast<double>(state.iterations() * array_actual->total_values_length());
+}
+
+static void BM_DeltaBitLengthEncodingByteArray(benchmark::State& state) {
Review Comment:
The official encoding name is "Delta-Length Byte Array", not "Delta-Bit-Length Byte Array"
```suggestion
static void BM_DeltaLengthEncodingByteArray(benchmark::State& state) {
```
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] pitrou commented on a diff in pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on code in PR #34323:
URL: https://github.com/apache/arrow/pull/34323#discussion_r1120119939
##########
cpp/src/parquet/encoding_benchmark.cc:
##########
@@ -634,6 +761,26 @@ static void BM_DictDecodingInt64_literals(benchmark::State& state) {
BENCHMARK(BM_DictDecodingInt64_literals)->Range(MIN_RANGE, MAX_RANGE);
+static void BM_DictDecodingByteArray(benchmark::State& state) {
+ ::arrow::random::RandomArrayGenerator rag(0);
+ // Using arrow generator to generate random data.
+ int32_t max_length = static_cast<int32_t>(state.range(0));
+ int32_t array_size = static_cast<int32_t>(state.range(1));
+ auto array =
+ rag.String(/* size */ array_size, /* min_length */ 0, /* max_length */ max_length,
+ /* null_probability */ 0);
+ const auto array_actual =
+ ::arrow::internal::checked_pointer_cast<::arrow::StringArray>(array);
+ auto encoder = MakeDictDecoder<ByteArrayType>();
+ std::vector<ByteArray> values;
+ for (int i = 0; i < array_actual->length(); ++i) {
+ values.emplace_back(array_actual->GetView(i));
+ }
+ DecodeDict<ByteArrayType>(values, state);
Review Comment:
Can you add a `SetItemsProcessed` at the end of `DecodeDict`?
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] mapleFU commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1447528488
@wgtmac @rok
1. Dict Decoding for ByteArray is added, but in our current benchmark, there is no ndv. Seems I can add a ndv for benchmark dict in the future
2. Different batch size is added
The benchmark data is listed below:
```
-------------------------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations UserCounters...
-------------------------------------------------------------------------------------------------------------
BM_PlainEncodingByteArray/8/8 235 ns 228 ns 3065389 byte_array_bytes=104.223M items_per_second=35.074M/s
BM_PlainEncodingByteArray/64/8 396 ns 370 ns 2015966 byte_array_bytes=637.045M items_per_second=21.6312M/s
BM_PlainEncodingByteArray/512/8 371 ns 365 ns 1874429 byte_array_bytes=3.37022G items_per_second=21.9365M/s
BM_PlainEncodingByteArray/1024/8 401 ns 390 ns 1819042 byte_array_bytes=4.31113G items_per_second=20.5191M/s
BM_PlainEncodingByteArray/8/64 580 ns 566 ns 1230099 byte_array_bytes=334.587M items_per_second=113.158M/s
BM_PlainEncodingByteArray/64/64 829 ns 816 ns 857780 byte_array_bytes=1.65037G items_per_second=78.449M/s
BM_PlainEncodingByteArray/512/64 1881 ns 1856 ns 393902 byte_array_bytes=6.6148G items_per_second=34.48M/s
BM_PlainEncodingByteArray/1024/64 9410 ns 8131 ns 84531 byte_array_bytes=2.7596G items_per_second=7.87144M/s
BM_PlainEncodingByteArray/8/512 2214 ns 2208 ns 317557 byte_array_bytes=644.641M items_per_second=231.851M/s
BM_PlainEncodingByteArray/64/512 4019 ns 4016 ns 168215 byte_array_bytes=2.7811G items_per_second=127.486M/s
BM_PlainEncodingByteArray/512/512 19707 ns 19346 ns 36416 byte_array_bytes=4.69737G items_per_second=26.4651M/s
BM_PlainEncodingByteArray/1024/512 63092 ns 62419 ns 11561 byte_array_bytes=3.12039G items_per_second=8.20265M/s
BM_PlainEncodingByteArray/8/1024 4484 ns 4484 ns 155323 byte_array_bytes=637.446M items_per_second=228.367M/s
BM_PlainEncodingByteArray/64/1024 19180 ns 18981 ns 37781 byte_array_bytes=1.22762G items_per_second=53.9499M/s
BM_PlainEncodingByteArray/512/1024 86915 ns 80674 ns 8801 byte_array_bytes=2.32632G items_per_second=12.6931M/s
BM_PlainEncodingByteArray/1024/1024 92043 ns 78708 ns 9747 byte_array_bytes=5.16017G items_per_second=13.0102M/s
BM_DeltaBitLengthEncodingByteArray/8/8 747 ns 733 ns 960272 byte_array_bytes=32.6492M items_per_second=10.9149M/s
BM_DeltaBitLengthEncodingByteArray/64/8 775 ns 760 ns 905996 byte_array_bytes=286.295M items_per_second=10.5287M/s
BM_DeltaBitLengthEncodingByteArray/512/8 796 ns 780 ns 905621 byte_array_bytes=1.62831G items_per_second=10.2597M/s
BM_DeltaBitLengthEncodingByteArray/1024/8 794 ns 787 ns 885661 byte_array_bytes=2.09902G items_per_second=10.1652M/s
BM_DeltaBitLengthEncodingByteArray/8/64 1261 ns 1231 ns 578441 byte_array_bytes=157.336M items_per_second=51.9844M/s
BM_DeltaBitLengthEncodingByteArray/64/64 1374 ns 1364 ns 510900 byte_array_bytes=982.972M items_per_second=46.9351M/s
BM_DeltaBitLengthEncodingByteArray/512/64 1650 ns 1643 ns 437511 byte_array_bytes=7.34712G items_per_second=38.9574M/s
BM_DeltaBitLengthEncodingByteArray/1024/64 11026 ns 9007 ns 73656 byte_array_bytes=2.40457G items_per_second=7.10521M/s
BM_DeltaBitLengthEncodingByteArray/8/512 6608 ns 6269 ns 116291 byte_array_bytes=236.071M items_per_second=81.6661M/s
BM_DeltaBitLengthEncodingByteArray/64/512 7989 ns 7394 ns 92218 byte_array_bytes=1.52464G items_per_second=69.2451M/s
BM_DeltaBitLengthEncodingByteArray/512/512 58210 ns 41833 ns 17754 byte_array_bytes=2.29012G items_per_second=12.239M/s
BM_DeltaBitLengthEncodingByteArray/1024/512 81322 ns 67902 ns 10659 byte_array_bytes=2.87694G items_per_second=7.54026M/s
BM_DeltaBitLengthEncodingByteArray/8/1024 12956 ns 12113 ns 60335 byte_array_bytes=247.615M items_per_second=84.536M/s
BM_DeltaBitLengthEncodingByteArray/64/1024 26775 ns 22107 ns 30578 byte_array_bytes=993.571M items_per_second=46.3211M/s
BM_DeltaBitLengthEncodingByteArray/512/1024 88313 ns 72388 ns 9790 byte_array_bytes=2.58773G items_per_second=14.146M/s
BM_DeltaBitLengthEncodingByteArray/1024/1024 141532 ns 122762 ns 5944 byte_array_bytes=3.14682G items_per_second=8.34132M/s
BM_PlainDecodingByteArray/8/8 137 ns 125 ns 5639113 byte_array_bytes=191.73M items_per_second=64.0507M/s
BM_PlainDecodingByteArray/64/8 127 ns 123 ns 5670358 byte_array_bytes=1.79183G items_per_second=64.9014M/s
BM_PlainDecodingByteArray/512/8 124 ns 122 ns 5829301 byte_array_bytes=10.4811G items_per_second=65.7388M/s
BM_PlainDecodingByteArray/1024/8 143 ns 125 ns 5804552 byte_array_bytes=13.7568G items_per_second=64.0992M/s
BM_PlainDecodingByteArray/8/64 311 ns 246 ns 2895170 byte_array_bytes=787.486M items_per_second=259.683M/s
BM_PlainDecodingByteArray/64/64 227 ns 226 ns 2851486 byte_array_bytes=5.48626G items_per_second=283.404M/s
BM_PlainDecodingByteArray/512/64 231 ns 229 ns 3030998 byte_array_bytes=50.8995G items_per_second=279.919M/s
BM_PlainDecodingByteArray/1024/64 224 ns 223 ns 3125963 byte_array_bytes=102.05G items_per_second=286.763M/s
BM_PlainDecodingByteArray/8/512 1098 ns 1097 ns 630619 byte_array_bytes=1.28016G items_per_second=466.662M/s
BM_PlainDecodingByteArray/64/512 1112 ns 1102 ns 645733 byte_array_bytes=10.6759G items_per_second=464.412M/s
BM_PlainDecodingByteArray/512/512 1200 ns 1161 ns 614634 byte_array_bytes=79.2829G items_per_second=441.183M/s
BM_PlainDecodingByteArray/1024/512 1229 ns 1174 ns 603589 byte_array_bytes=162.913G items_per_second=436.226M/s
BM_PlainDecodingByteArray/8/1024 2290 ns 2186 ns 312444 byte_array_bytes=1.28227G items_per_second=468.407M/s
BM_PlainDecodingByteArray/64/1024 2632 ns 2300 ns 303235 byte_array_bytes=9.85301G items_per_second=445.132M/s
BM_PlainDecodingByteArray/512/1024 3790 ns 3536 ns 200536 byte_array_bytes=53.0065G items_per_second=289.603M/s
BM_PlainDecodingByteArray/1024/1024 3198 ns 3178 ns 222884 byte_array_bytes=117.997G items_per_second=322.171M/s
BM_DeltaBitLengthDecodingByteArray/8/8 689 ns 672 ns 1045229 byte_array_bytes=35.5378M items_per_second=11.9118M/s
BM_DeltaBitLengthDecodingByteArray/64/8 751 ns 743 ns 903342 byte_array_bytes=285.456M items_per_second=10.7662M/s
BM_DeltaBitLengthDecodingByteArray/512/8 1055 ns 1051 ns 655879 byte_array_bytes=1.17927G items_per_second=7.61373M/s
BM_DeltaBitLengthDecodingByteArray/1024/8 1179 ns 1170 ns 603204 byte_array_bytes=1.42959G items_per_second=6.83965M/s
BM_DeltaBitLengthDecodingByteArray/8/64 829 ns 819 ns 855254 byte_array_bytes=232.629M items_per_second=78.1025M/s
BM_DeltaBitLengthDecodingByteArray/64/64 1184 ns 1176 ns 602213 byte_array_bytes=1.15866G items_per_second=54.4343M/s
BM_DeltaBitLengthDecodingByteArray/512/64 4279 ns 4276 ns 163854 byte_array_bytes=2.7516G items_per_second=14.9689M/s
BM_DeltaBitLengthDecodingByteArray/1024/64 7645 ns 7615 ns 92953 byte_array_bytes=3.03454G items_per_second=8.40392M/s
BM_DeltaBitLengthDecodingByteArray/8/512 1925 ns 1922 ns 363082 byte_array_bytes=737.056M items_per_second=266.345M/s
BM_DeltaBitLengthDecodingByteArray/64/512 5109 ns 5044 ns 139495 byte_array_bytes=2.30627G items_per_second=101.512M/s
BM_DeltaBitLengthDecodingByteArray/512/512 41306 ns 40867 ns 16609 byte_array_bytes=2.14243G items_per_second=12.5285M/s
BM_DeltaBitLengthDecodingByteArray/1024/512 80874 ns 79691 ns 8941 byte_array_bytes=2.41324G items_per_second=6.42482M/s
BM_DeltaBitLengthDecodingByteArray/8/1024 3208 ns 3206 ns 219540 byte_array_bytes=900.992M items_per_second=319.394M/s
BM_DeltaBitLengthDecodingByteArray/64/1024 9308 ns 9303 ns 74957 byte_array_bytes=2.43558G items_per_second=110.077M/s
BM_DeltaBitLengthDecodingByteArray/512/1024 80116 ns 80005 ns 8506 byte_array_bytes=2.24834G items_per_second=12.7992M/s
BM_DeltaBitLengthDecodingByteArray/1024/1024 154870 ns 154196 ns 4420 byte_array_bytes=2.34G items_per_second=6.64089M/s
BM_PlainDecodingSpacedByteArray/8/8 10.4 ns 10.4 ns 67218499 byte_array_bytes=2.28543G items_per_second=772.044M/s null_percent=2
BM_PlainDecodingSpacedByteArray/64/8 10.5 ns 10.5 ns 66603235 byte_array_bytes=21.0466G items_per_second=762.433M/s null_percent=2
BM_PlainDecodingSpacedByteArray/512/8 10.4 ns 10.4 ns 68236097 byte_array_bytes=122.689G items_per_second=770.475M/s null_percent=2
BM_PlainDecodingSpacedByteArray/1024/8 10.8 ns 10.8 ns 67406209 byte_array_bytes=159.753G items_per_second=743.078M/s null_percent=2
BM_PlainDecodingSpacedByteArray/8/64 144 ns 144 ns 4810600 byte_array_bytes=1.29405G items_per_second=444.822M/s null_percent=2
BM_PlainDecodingSpacedByteArray/64/64 144 ns 144 ns 4845364 byte_array_bytes=9.13836G items_per_second=444.619M/s null_percent=2
BM_PlainDecodingSpacedByteArray/512/64 152 ns 148 ns 4719684 byte_array_bytes=77.7615G items_per_second=431.605M/s null_percent=2
BM_PlainDecodingSpacedByteArray/1024/64 159 ns 151 ns 4773628 byte_array_bytes=152.04G items_per_second=424.058M/s null_percent=2
BM_PlainDecodingSpacedByteArray/8/512 1216 ns 1180 ns 583946 byte_array_bytes=1.17023G items_per_second=433.89M/s null_percent=2
BM_PlainDecodingSpacedByteArray/64/512 1173 ns 1164 ns 611551 byte_array_bytes=9.93403G items_per_second=439.96M/s null_percent=2
BM_PlainDecodingSpacedByteArray/512/512 1205 ns 1193 ns 598792 byte_array_bytes=75.7496G items_per_second=429.141M/s null_percent=2
BM_PlainDecodingSpacedByteArray/1024/512 1201 ns 1181 ns 594233 byte_array_bytes=157.627G items_per_second=433.348M/s null_percent=2
BM_PlainDecodingSpacedByteArray/8/1024 2344 ns 2330 ns 280204 byte_array_bytes=1.12922G items_per_second=439.487M/s null_percent=2
BM_PlainDecodingSpacedByteArray/64/1024 2323 ns 2312 ns 304577 byte_array_bytes=9.66727G items_per_second=442.964M/s null_percent=2
BM_PlainDecodingSpacedByteArray/512/1024 4764 ns 4707 ns 154352 byte_array_bytes=39.936G items_per_second=217.534M/s null_percent=2
BM_PlainDecodingSpacedByteArray/1024/1024 3067 ns 3061 ns 217958 byte_array_bytes=113.274G items_per_second=334.54M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/8/8 287 ns 271 ns 2666616 byte_array_bytes=90.6649M items_per_second=29.4838M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/64/8 324 ns 324 ns 2148043 byte_array_bytes=678.782M items_per_second=24.7125M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/512/8 630 ns 629 ns 1120197 byte_array_bytes=2.01411G items_per_second=12.7162M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/1024/8 761 ns 753 ns 947816 byte_array_bytes=2.24632G items_per_second=10.6185M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/8/64 444 ns 444 ns 1604485 byte_array_bytes=431.606M items_per_second=144.24M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/64/64 816 ns 811 ns 870041 byte_array_bytes=1.6409G items_per_second=78.9493M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/512/64 3914 ns 3903 ns 177444 byte_array_bytes=2.92357G items_per_second=16.3984M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/1024/64 8412 ns 7518 ns 97220 byte_array_bytes=3.09646G items_per_second=8.51239M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/8/512 2265 ns 1855 ns 391519 byte_array_bytes=784.604M items_per_second=276.042M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/64/512 5374 ns 5112 ns 100000 byte_array_bytes=1.6244G items_per_second=100.165M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/512/512 32772 ns 30121 ns 23796 byte_array_bytes=3.01029G items_per_second=16.9983M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/1024/512 58609 ns 58345 ns 11690 byte_array_bytes=3.10091G items_per_second=8.77535M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/8/1024 3191 ns 3178 ns 222474 byte_array_bytes=896.57M items_per_second=322.247M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/64/1024 9198 ns 9125 ns 75708 byte_array_bytes=2.40297G items_per_second=112.224M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/512/1024 58358 ns 58147 ns 12110 byte_array_bytes=3.13326G items_per_second=17.6106M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/1024/1024 120708 ns 115508 ns 6136 byte_array_bytes=3.18891G items_per_second=8.86519M/s null_percent=2
BM_DictDecodingByteArray/8/8 904 ns 893 ns 750035 bytes_per_second=136.719M/s
BM_DictDecodingByteArray/64/8 931 ns 923 ns 768133 bytes_per_second=1057.74M/s
BM_DictDecodingByteArray/512/8 907 ns 905 ns 758651 bytes_per_second=8.42918G/s
BM_DictDecodingByteArray/1024/8 950 ns 930 ns 763309 bytes_per_second=16.4053G/s
BM_DictDecodingByteArray/8/64 1155 ns 1152 ns 603532 bytes_per_second=105.942M/s
BM_DictDecodingByteArray/64/64 1302 ns 1300 ns 532097 bytes_per_second=751.171M/s
BM_DictDecodingByteArray/512/64 1377 ns 1370 ns 514895 bytes_per_second=5.57052G/s
BM_DictDecodingByteArray/1024/64 1592 ns 1588 ns 440038 bytes_per_second=9.60928G/s
BM_DictDecodingByteArray/8/512 3454 ns 3445 ns 198841 bytes_per_second=35.4355M/s
BM_DictDecodingByteArray/64/512 4939 ns 4922 ns 141697 bytes_per_second=198.411M/s
BM_DictDecodingByteArray/512/512 21046 ns 20583 ns 34146 bytes_per_second=379.56M/s
BM_DictDecodingByteArray/1024/512 40554 ns 37768 ns 17072 bytes_per_second=413.711M/s
BM_DictDecodingByteArray/8/1024 5964 ns 5929 ns 118177 bytes_per_second=20.587M/s
BM_DictDecodingByteArray/64/1024 9671 ns 9652 ns 72344 bytes_per_second=101.177M/s
BM_DictDecodingByteArray/512/1024 39855 ns 38685 ns 17524 bytes_per_second=201.954M/s
BM_DictDecodingByteArray/1024/1024 70775 ns 70380 ns 10262 bytes_per_second=222.009M/s
```
Runing on x86 may got a bit differents, because it can make full use of simd unpack, which could make Dict Decoding a bit faster
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] rok commented on a diff in pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "rok (via GitHub)" <gi...@apache.org>.
rok commented on code in PR #34323:
URL: https://github.com/apache/arrow/pull/34323#discussion_r1128331744
##########
cpp/src/parquet/encoding_benchmark.cc:
##########
@@ -569,6 +569,130 @@ BENCHMARK(BM_DeltaBitPackingDecode_Int64_Narrow)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int32_Wide)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int64_Wide)->Range(MIN_RANGE, MAX_RANGE);
+static void ByteArrayCustomArguments(benchmark::internal::Benchmark* b) {
+ b->ArgsProduct({{8, 64, 1024}, {512, 2048}})
+ ->ArgNames({"max-string-length", "batch-size"});
+}
+
+void EncodingByteArrayBenchmark(benchmark::State& state, Encoding::type encoding) {
+ ::arrow::random::RandomArrayGenerator rag(0);
+ // Using arrow generator to generate random data.
+ int32_t max_length = static_cast<int32_t>(state.range(0));
+ int32_t array_size = static_cast<int32_t>(state.range(1));
+ auto array =
+ rag.String(/* size */ array_size, /* min_length */ 0, /* max_length */ max_length,
+ /* null_probability */ 0);
+ const auto array_actual =
+ ::arrow::internal::checked_pointer_cast<::arrow::StringArray>(array);
+ auto encoder = MakeTypedEncoder<ByteArrayType>(encoding);
+ std::vector<ByteArray> values;
+ for (int i = 0; i < array_actual->length(); ++i) {
+ values.emplace_back(array_actual->GetView(i));
+ }
+
+ for (auto _ : state) {
+ encoder->Put(values.data(), static_cast<int>(values.size()));
+ encoder->FlushValues();
+ }
+ state.SetItemsProcessed(state.iterations() * array_actual->length());
+ state.SetBytesProcessed(state.iterations() * array_actual->total_values_length());
+}
+
+static void BM_DeltaLengthEncodingByteArray(benchmark::State& state) {
+ EncodingByteArrayBenchmark(state, Encoding::DELTA_LENGTH_BYTE_ARRAY);
+}
+
+static void BM_PlainEncodingByteArray(benchmark::State& state) {
+ EncodingByteArrayBenchmark(state, Encoding::PLAIN);
+}
+
+void DecodingByteArrayBenchmark(benchmark::State& state, Encoding::type encoding) {
+ ::arrow::random::RandomArrayGenerator rag(0);
+ int32_t max_length = static_cast<int32_t>(state.range(0));
+ int32_t array_size = static_cast<int32_t>(state.range(1));
+ // Using arrow to write, because we just benchmark decoding here.
+ auto array =
+ rag.String(/* size */ array_size, /* min_length */ 0, /* max_length */ max_length,
+ /* null_probability */ 0);
+ const auto array_actual =
+ ::arrow::internal::checked_pointer_cast<::arrow::StringArray>(array);
+ auto encoder = MakeTypedEncoder<ByteArrayType>(encoding);
+ encoder->Put(*array);
+ std::shared_ptr<Buffer> buf = encoder->FlushValues();
+
+ std::vector<ByteArray> values;
+ values.resize(array->length());
+ for (auto _ : state) {
+ auto decoder = MakeTypedDecoder<ByteArrayType>(encoding);
+ decoder->SetData(static_cast<int>(array->length()), buf->data(),
+ static_cast<int>(buf->size()));
+ decoder->Decode(values.data(), static_cast<int>(values.size()));
+ ::benchmark::DoNotOptimize(values);
+ }
+ state.SetItemsProcessed(state.iterations() * array->length());
Review Comment:
Should this be like so?:
```suggestion
state.SetItemsProcessed(state.iterations() * array_actual->length());
```
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] rok commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "rok (via GitHub)" <gi...@apache.org>.
rok commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1449074460
Optimizations would be great but let's track them in separate issues and use ursabot commands (listed here https://ursalabs.org/blog/announcing-conbench/).
This looks good to me.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] wgtmac commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "wgtmac (via GitHub)" <gi...@apache.org>.
wgtmac commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1443160060
@mapleFU Any benchmark data?
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] pitrou commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1447947585
> Okay, I'll
>
> 1. Test Processing max-length: 8, 64, 1024
+1
> 2. Batch-size (num string processed): 512, 1024, 2048
Just reduce that to 512, 2048? Actually, is it even useful to vary the batch size?
> 3. `"byte_array_bytes"` means the accumulated length of string a benchmark processed.
Ok, but is it the memory footprint? Otherwise, it's probably not useful to output.
> Do you think above argument is ok? Or it's still too much testcases? @pitrou
>
> (Personally, I just use `benchmark_filter` to run the case I expect to run )
Right, but in some cases you want to run all Parquet encoding benchmarks to check for a regression/improvement.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] pitrou commented on a diff in pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on code in PR #34323:
URL: https://github.com/apache/arrow/pull/34323#discussion_r1120118516
##########
cpp/src/parquet/encoding_benchmark.cc:
##########
@@ -569,6 +569,133 @@ BENCHMARK(BM_DeltaBitPackingDecode_Int64_Narrow)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int32_Wide)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int64_Wide)->Range(MIN_RANGE, MAX_RANGE);
+static void ByteArrayCustomArguments(benchmark::internal::Benchmark* b) {
+ b->ArgsProduct({{8, 64, 1024}, {512, 2048}})
+ ->ArgNames({"max-string-length", "batch-size"});
+}
+
+void EncodingByteArrayBenchmark(benchmark::State& state, Encoding::type encoding) {
+ ::arrow::random::RandomArrayGenerator rag(0);
+ // Using arrow generator to generate random data.
+ int32_t max_length = static_cast<int32_t>(state.range(0));
+ int32_t array_size = static_cast<int32_t>(state.range(1));
+ auto array =
+ rag.String(/* size */ array_size, /* min_length */ 0, /* max_length */ max_length,
+ /* null_probability */ 0);
+ const auto array_actual =
+ ::arrow::internal::checked_pointer_cast<::arrow::StringArray>(array);
+ auto encoder = MakeTypedEncoder<ByteArrayType>(encoding);
+ std::vector<ByteArray> values;
+ for (int i = 0; i < array_actual->length(); ++i) {
+ values.emplace_back(array_actual->GetView(i));
+ }
+
+ for (auto _ : state) {
+ encoder->Put(values.data(), static_cast<int>(values.size()));
+ encoder->FlushValues();
+ }
+ state.SetItemsProcessed(state.iterations() * array_actual->length());
+ state.counters["byte_array_bytes"] =
+ static_cast<double>(state.iterations() * array_actual->total_values_length());
+}
+
+static void BM_DeltaBitLengthEncodingByteArray(benchmark::State& state) {
+ EncodingByteArrayBenchmark(state, Encoding::DELTA_LENGTH_BYTE_ARRAY);
+}
+
+static void BM_PlainEncodingByteArray(benchmark::State& state) {
+ EncodingByteArrayBenchmark(state, Encoding::PLAIN);
+}
+
+void DecodingByteArrayBenchmark(benchmark::State& state, Encoding::type encoding) {
+ ::arrow::random::RandomArrayGenerator rag(0);
+ int32_t max_length = static_cast<int32_t>(state.range(0));
+ int32_t array_size = static_cast<int32_t>(state.range(1));
+ // Using arrow to write, because we just benchmark decoding here.
+ auto array =
+ rag.String(/* size */ array_size, /* min_length */ 0, /* max_length */ max_length,
+ /* null_probability */ 0);
+ const auto array_actual =
+ ::arrow::internal::checked_pointer_cast<::arrow::StringArray>(array);
+ auto encoder = MakeTypedEncoder<ByteArrayType>(encoding);
+ encoder->Put(*array);
+ std::shared_ptr<Buffer> buf = encoder->FlushValues();
+
+ std::vector<ByteArray> values;
+ values.resize(array->length());
+ for (auto _ : state) {
+ auto decoder = MakeTypedDecoder<ByteArrayType>(encoding);
+ decoder->SetData(static_cast<int>(array->length()), buf->data(),
+ static_cast<int>(buf->size()));
+ decoder->Decode(values.data(), static_cast<int>(values.size()));
+ ::benchmark::DoNotOptimize(values);
+ }
+ state.SetItemsProcessed(state.iterations() * array->length());
+ state.counters["byte_array_bytes"] =
+ static_cast<double>(state.iterations() * array_actual->total_values_length());
+}
+
+static void BM_PlainDecodingByteArray(benchmark::State& state) {
+ DecodingByteArrayBenchmark(state, Encoding::PLAIN);
+}
+
+static void BM_DeltaBitLengthDecodingByteArray(benchmark::State& state) {
Review Comment:
```suggestion
static void BM_DeltaLengthDecodingByteArray(benchmark::State& state) {
```
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] mapleFU commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1448330011
@pitrou comments solved. Seems that it's for encoding, some tiny optimize can be used. And for decoder, maybe implement zero-copy could benefits performance a lot. After this patch merged. We can work on https://github.com/apache/arrow/pull/34336 and dict decoder to optimize these decoders
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] mapleFU commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1447531428
Seems the batch size sometimes impact the performance a lot ...
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] mapleFU commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1442768819
/cc @rok
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] rok commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "rok (via GitHub)" <gi...@apache.org>.
rok commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1443328398
You are currently test strings of length 0 - 1024 with uniform length distribution. Maybe longer ones could be interesting, or maybe a range from say 4 - 20 or just all the of length 8. Or maybe a mix of 95% uniform distribution of 0 - 10 and 5% uniform distribution of 500 - 1000. Perhaps you can try locally if you get interesting results and only include different benchmarks.
> By the way, I think it's trickey that, DELTA_LENGTH would be powerful when compression is enabled. However, currently we don't test compression during encoding benchmark
Maybe that's worth opening another issue?
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] wjones127 commented on a diff in pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "wjones127 (via GitHub)" <gi...@apache.org>.
wjones127 commented on code in PR #34323:
URL: https://github.com/apache/arrow/pull/34323#discussion_r1128329500
##########
cpp/src/parquet/encoding_benchmark.cc:
##########
@@ -569,6 +569,130 @@ BENCHMARK(BM_DeltaBitPackingDecode_Int64_Narrow)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int32_Wide)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int64_Wide)->Range(MIN_RANGE, MAX_RANGE);
+static void ByteArrayCustomArguments(benchmark::internal::Benchmark* b) {
+ b->ArgsProduct({{8, 64, 1024}, {512, 2048}})
+ ->ArgNames({"max-string-length", "batch-size"});
+}
+
+void EncodingByteArrayBenchmark(benchmark::State& state, Encoding::type encoding) {
+ ::arrow::random::RandomArrayGenerator rag(0);
+ // Using arrow generator to generate random data.
+ int32_t max_length = static_cast<int32_t>(state.range(0));
+ int32_t array_size = static_cast<int32_t>(state.range(1));
+ auto array =
+ rag.String(/* size */ array_size, /* min_length */ 0, /* max_length */ max_length,
+ /* null_probability */ 0);
+ const auto array_actual =
+ ::arrow::internal::checked_pointer_cast<::arrow::StringArray>(array);
+ auto encoder = MakeTypedEncoder<ByteArrayType>(encoding);
+ std::vector<ByteArray> values;
+ for (int i = 0; i < array_actual->length(); ++i) {
+ values.emplace_back(array_actual->GetView(i));
+ }
+
+ for (auto _ : state) {
+ encoder->Put(values.data(), static_cast<int>(values.size()));
+ encoder->FlushValues();
+ }
+ state.SetItemsProcessed(state.iterations() * array_actual->length());
+ state.SetBytesProcessed(state.iterations() * array_actual->total_values_length());
+}
+
+static void BM_DeltaLengthEncodingByteArray(benchmark::State& state) {
+ EncodingByteArrayBenchmark(state, Encoding::DELTA_LENGTH_BYTE_ARRAY);
+}
+
+static void BM_PlainEncodingByteArray(benchmark::State& state) {
+ EncodingByteArrayBenchmark(state, Encoding::PLAIN);
+}
+
+void DecodingByteArrayBenchmark(benchmark::State& state, Encoding::type encoding) {
+ ::arrow::random::RandomArrayGenerator rag(0);
+ int32_t max_length = static_cast<int32_t>(state.range(0));
+ int32_t array_size = static_cast<int32_t>(state.range(1));
+ // Using arrow to write, because we just benchmark decoding here.
+ auto array =
+ rag.String(/* size */ array_size, /* min_length */ 0, /* max_length */ max_length,
+ /* null_probability */ 0);
+ const auto array_actual =
+ ::arrow::internal::checked_pointer_cast<::arrow::StringArray>(array);
+ auto encoder = MakeTypedEncoder<ByteArrayType>(encoding);
+ encoder->Put(*array);
+ std::shared_ptr<Buffer> buf = encoder->FlushValues();
+
+ std::vector<ByteArray> values;
+ values.resize(array->length());
+ for (auto _ : state) {
+ auto decoder = MakeTypedDecoder<ByteArrayType>(encoding);
+ decoder->SetData(static_cast<int>(array->length()), buf->data(),
+ static_cast<int>(buf->size()));
+ decoder->Decode(values.data(), static_cast<int>(values.size()));
+ ::benchmark::DoNotOptimize(values);
+ }
+ state.SetItemsProcessed(state.iterations() * array->length());
+ state.SetBytesProcessed(state.iterations() * array_actual->total_values_length());
+}
+
+static void BM_PlainDecodingByteArray(benchmark::State& state) {
+ DecodingByteArrayBenchmark(state, Encoding::PLAIN);
+}
+
+static void BM_DeltaLengthDecodingByteArray(benchmark::State& state) {
+ DecodingByteArrayBenchmark(state, Encoding::DELTA_LENGTH_BYTE_ARRAY);
+}
+
+BENCHMARK(BM_PlainEncodingByteArray)->Apply(ByteArrayCustomArguments);
+BENCHMARK(BM_DeltaLengthEncodingByteArray)->Apply(ByteArrayCustomArguments);
+BENCHMARK(BM_PlainDecodingByteArray)->Apply(ByteArrayCustomArguments);
+BENCHMARK(BM_DeltaLengthDecodingByteArray)->Apply(ByteArrayCustomArguments);
+
+static void BM_DecodingByteArraySpaced(benchmark::State& state, Encoding::type encoding) {
+ const double null_percent = 0.02;
+
+ auto rand = ::arrow::random::RandomArrayGenerator(0);
+ int32_t max_length = static_cast<int32_t>(state.range(0));
+ int32_t num_values = static_cast<int32_t>(state.range(1));
+ const auto array = rand.String(num_values, /* min_length */ 0,
+ /* max_length */ max_length, null_percent);
+ const auto valid_bits = array->null_bitmap_data();
+ const int null_count = static_cast<int>(array->null_count());
+ const auto array_actual =
+ ::arrow::internal::checked_pointer_cast<::arrow::StringArray>(array);
+
+ std::vector<ByteArray> byte_arrays;
+ byte_arrays.reserve(array_actual->length());
+ for (int i = 0; i < array_actual->length(); ++i) {
+ byte_arrays.emplace_back(array_actual->GetView(i));
+ }
+
+ auto encoder = MakeTypedEncoder<ByteArrayType>(encoding);
+ encoder->PutSpaced(byte_arrays.data(), num_values, valid_bits, 0);
+ std::shared_ptr<Buffer> buf = encoder->FlushValues();
+
+ auto decoder = MakeTypedDecoder<ByteArrayType>(encoding);
+ std::vector<uint8_t> decode_values(num_values * sizeof(ByteArray));
+ auto decode_buf = reinterpret_cast<ByteArray*>(decode_values.data());
+ for (auto _ : state) {
+ decoder->SetData(num_values - null_count, buf->data(), static_cast<int>(buf->size()));
+ decoder->DecodeSpaced(decode_buf, num_values, null_count, valid_bits, 0);
+ ::benchmark::DoNotOptimize(decode_buf);
+ }
+ state.counters["null_percent"] = null_percent * 100;
+ state.SetItemsProcessed(state.iterations() * array_actual->length());
+ state.SetBytesProcessed(state.iterations() * array_actual->total_values_length());
Review Comment:
Elsewhere I know we consider both the size of values *and* offsets in the bytes processed. But not sure if it's necessarily worth doing in these benchmarks.
https://github.com/apache/arrow/blob/864ba8221e0e852a9013d0692310c0f91b9b3b80/cpp/src/parquet/arrow/reader_writer_benchmark.cc#L230-L234
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] github-actions[bot] commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1442768723
* Closes: #34322
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] pitrou commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1447914280
A couple general comments:
* we should avoid combinatorial explosion of benchmark variations; the longer benchmarks take to run, the rarer it is to run them; you could easily reduce the number of "max-string-length" values for example
* we should test only meaningful or reasonable parameters; if "batch-size:8" means process 8 items at a time, I think the easy answer is "don't do it"; Parquet encoding/decoding need batch sizes in the hundreds or thousands to be efficient
* the memory footprint of each benchmark should be similar and reasonable; if "byte_array_bytes" is the memory footprint then this must be fixed; most of the time the footprint should not be larger than ~10 MB
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] wgtmac commented on a diff in pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "wgtmac (via GitHub)" <gi...@apache.org>.
wgtmac commented on code in PR #34323:
URL: https://github.com/apache/arrow/pull/34323#discussion_r1118300870
##########
cpp/src/parquet/encoding_benchmark.cc:
##########
@@ -569,6 +569,126 @@ BENCHMARK(BM_DeltaBitPackingDecode_Int64_Narrow)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int32_Wide)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int64_Wide)->Range(MIN_RANGE, MAX_RANGE);
+void EncodingByteArrayBenchmark(benchmark::State& state, Encoding::type encoding) {
+ ::arrow::random::RandomArrayGenerator rag(0);
+ // Using arrow generator to generate random data.
+ int32_t max_length = state.range(0);
+ auto array =
+ rag.String(/* size */ 1024, /* min_length */ 0, /* max_length */ max_length,
Review Comment:
Should the size (1024 here) be adjustable? Reasonable options may include 256, 512, 4096.
##########
cpp/src/parquet/encoding_benchmark.cc:
##########
@@ -569,6 +569,126 @@ BENCHMARK(BM_DeltaBitPackingDecode_Int64_Narrow)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int32_Wide)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int64_Wide)->Range(MIN_RANGE, MAX_RANGE);
+void EncodingByteArrayBenchmark(benchmark::State& state, Encoding::type encoding) {
+ ::arrow::random::RandomArrayGenerator rag(0);
+ // Using arrow generator to generate random data.
+ int32_t max_length = state.range(0);
+ auto array =
+ rag.String(/* size */ 1024, /* min_length */ 0, /* max_length */ max_length,
+ /* null_probability */ 0);
+ const auto array_actual =
+ ::arrow::internal::checked_pointer_cast<::arrow::StringArray>(array);
+ auto encoder = MakeTypedEncoder<ByteArrayType>(encoding);
+ std::vector<ByteArray> values;
+ for (int i = 0; i < array_actual->length(); ++i) {
+ values.emplace_back(array_actual->GetView(i));
+ }
+
+ for (auto _ : state) {
+ encoder->Put(values.data(), static_cast<int>(values.size()));
+ encoder->FlushValues();
+ }
+ state.SetItemsProcessed(state.iterations() * array_actual->length());
+ state.counters["byte_array_bytes"] =
+ state.iterations() * array_actual->total_values_length();
+}
+
+static void BM_DeltaBitLengthEncodingByteArray(benchmark::State& state) {
+ EncodingByteArrayBenchmark(state, Encoding::DELTA_LENGTH_BYTE_ARRAY);
+}
+
+static void BM_PlainEncodingByteArray(benchmark::State& state) {
+ EncodingByteArrayBenchmark(state, Encoding::PLAIN);
+}
+
+void DecodingByteArrayBenchmark(benchmark::State& state, Encoding::type encoding) {
+ ::arrow::random::RandomArrayGenerator rag(0);
+ int32_t max_length = state.range(0);
+ // Using arrow to write, because we just benchmark decoding here.
+ auto array =
+ rag.String(/* size */ 1024, /* min_length */ 0, /* max_length */ max_length,
+ /* null_probability */ 0);
+ const auto array_actual =
+ ::arrow::internal::checked_pointer_cast<::arrow::StringArray>(array);
+ auto encoder = MakeTypedEncoder<ByteArrayType>(encoding);
+ encoder->Put(*array);
+ std::shared_ptr<Buffer> buf = encoder->FlushValues();
+
+ std::vector<ByteArray> values;
+ values.resize(array->length());
+ for (auto _ : state) {
+ auto decoder = MakeTypedDecoder<ByteArrayType>(encoding);
+ decoder->SetData(static_cast<int>(array->length()), buf->data(),
+ static_cast<int>(buf->size()));
+ decoder->Decode(values.data(), static_cast<int>(values.size()));
+ ::benchmark::DoNotOptimize(values);
+ }
+ state.SetItemsProcessed(state.iterations() * array->length());
+ state.counters["byte_array_bytes"] =
+ state.iterations() * array_actual->total_values_length();
+}
+
+static void BM_PlainDecodingByteArray(benchmark::State& state) {
+ DecodingByteArrayBenchmark(state, Encoding::PLAIN);
+}
+
+static void BM_DeltaBitLengthDecodingByteArray(benchmark::State& state) {
+ DecodingByteArrayBenchmark(state, Encoding::DELTA_LENGTH_BYTE_ARRAY);
+}
+
+BENCHMARK(BM_PlainEncodingByteArray)->Range(8, 1024);
+BENCHMARK(BM_DeltaBitLengthEncodingByteArray)->Range(8, 1024);
+BENCHMARK(BM_PlainDecodingByteArray)->Range(8, 1024);
+BENCHMARK(BM_DeltaBitLengthDecodingByteArray)->Range(8, 1024);
+
+static void BM_DecodingByteArraySpaced(benchmark::State& state, Encoding::type encoding) {
+ const int num_values = 1024;
+ const double null_percent = 0.02;
+
+ auto rand = ::arrow::random::RandomArrayGenerator(0);
+ int32_t max_length = state.range(0);
+ const auto array = rand.String(num_values, /* min_length */ 0,
+ /* max_length */ max_length, null_percent);
+ const auto valid_bits = array->null_bitmap_data();
+ const int null_count = static_cast<int>(array->null_count());
+ const auto array_actual =
+ ::arrow::internal::checked_pointer_cast<::arrow::StringArray>(array);
+
+ std::vector<ByteArray> byte_arrays;
+ byte_arrays.reserve(array_actual->length());
+ for (int i = 0; i < array_actual->length(); ++i) {
+ byte_arrays.emplace_back(array_actual->GetView(i));
+ }
+
+ auto encoder = MakeTypedEncoder<ByteArrayType>(encoding);
+ encoder->PutSpaced(byte_arrays.data(), num_values, valid_bits, 0);
+ std::shared_ptr<Buffer> buf = encoder->FlushValues();
+
+ auto decoder = MakeTypedDecoder<ByteArrayType>(encoding);
+ std::vector<uint8_t> decode_values(num_values * sizeof(ByteArray));
+ auto decode_buf = reinterpret_cast<ByteArray*>(decode_values.data());
+ for (auto _ : state) {
+ decoder->SetData(num_values - null_count, buf->data(), static_cast<int>(buf->size()));
+ decoder->DecodeSpaced(decode_buf, num_values, null_count, valid_bits, 0);
+ ::benchmark::DoNotOptimize(decode_buf);
+ }
+ state.counters["null_percent"] = null_percent * 100;
Review Comment:
```suggestion
state.counters["null_percentage"] = null_percent * 100;
```
##########
cpp/src/parquet/encoding_benchmark.cc:
##########
@@ -569,6 +569,126 @@ BENCHMARK(BM_DeltaBitPackingDecode_Int64_Narrow)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int32_Wide)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int64_Wide)->Range(MIN_RANGE, MAX_RANGE);
+void EncodingByteArrayBenchmark(benchmark::State& state, Encoding::type encoding) {
+ ::arrow::random::RandomArrayGenerator rag(0);
+ // Using arrow generator to generate random data.
+ int32_t max_length = state.range(0);
+ auto array =
+ rag.String(/* size */ 1024, /* min_length */ 0, /* max_length */ max_length,
+ /* null_probability */ 0);
+ const auto array_actual =
+ ::arrow::internal::checked_pointer_cast<::arrow::StringArray>(array);
+ auto encoder = MakeTypedEncoder<ByteArrayType>(encoding);
+ std::vector<ByteArray> values;
+ for (int i = 0; i < array_actual->length(); ++i) {
+ values.emplace_back(array_actual->GetView(i));
+ }
+
+ for (auto _ : state) {
+ encoder->Put(values.data(), static_cast<int>(values.size()));
+ encoder->FlushValues();
+ }
+ state.SetItemsProcessed(state.iterations() * array_actual->length());
+ state.counters["byte_array_bytes"] =
+ state.iterations() * array_actual->total_values_length();
+}
+
+static void BM_DeltaBitLengthEncodingByteArray(benchmark::State& state) {
+ EncodingByteArrayBenchmark(state, Encoding::DELTA_LENGTH_BYTE_ARRAY);
+}
+
+static void BM_PlainEncodingByteArray(benchmark::State& state) {
+ EncodingByteArrayBenchmark(state, Encoding::PLAIN);
Review Comment:
Should the dictionary encoder join the game too?
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] mapleFU commented on a diff in pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on code in PR #34323:
URL: https://github.com/apache/arrow/pull/34323#discussion_r1118619281
##########
cpp/src/parquet/encoding_benchmark.cc:
##########
@@ -569,6 +569,126 @@ BENCHMARK(BM_DeltaBitPackingDecode_Int64_Narrow)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int32_Wide)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int64_Wide)->Range(MIN_RANGE, MAX_RANGE);
+void EncodingByteArrayBenchmark(benchmark::State& state, Encoding::type encoding) {
+ ::arrow::random::RandomArrayGenerator rag(0);
+ // Using arrow generator to generate random data.
+ int32_t max_length = state.range(0);
+ auto array =
+ rag.String(/* size */ 1024, /* min_length */ 0, /* max_length */ max_length,
+ /* null_probability */ 0);
+ const auto array_actual =
+ ::arrow::internal::checked_pointer_cast<::arrow::StringArray>(array);
+ auto encoder = MakeTypedEncoder<ByteArrayType>(encoding);
+ std::vector<ByteArray> values;
+ for (int i = 0; i < array_actual->length(); ++i) {
+ values.emplace_back(array_actual->GetView(i));
+ }
+
+ for (auto _ : state) {
+ encoder->Put(values.data(), static_cast<int>(values.size()));
+ encoder->FlushValues();
+ }
+ state.SetItemsProcessed(state.iterations() * array_actual->length());
+ state.counters["byte_array_bytes"] =
+ state.iterations() * array_actual->total_values_length();
+}
+
+static void BM_DeltaBitLengthEncodingByteArray(benchmark::State& state) {
+ EncodingByteArrayBenchmark(state, Encoding::DELTA_LENGTH_BYTE_ARRAY);
+}
+
+static void BM_PlainEncodingByteArray(benchmark::State& state) {
+ EncodingByteArrayBenchmark(state, Encoding::PLAIN);
+}
+
+void DecodingByteArrayBenchmark(benchmark::State& state, Encoding::type encoding) {
+ ::arrow::random::RandomArrayGenerator rag(0);
+ int32_t max_length = state.range(0);
+ // Using arrow to write, because we just benchmark decoding here.
+ auto array =
+ rag.String(/* size */ 1024, /* min_length */ 0, /* max_length */ max_length,
+ /* null_probability */ 0);
+ const auto array_actual =
+ ::arrow::internal::checked_pointer_cast<::arrow::StringArray>(array);
+ auto encoder = MakeTypedEncoder<ByteArrayType>(encoding);
+ encoder->Put(*array);
+ std::shared_ptr<Buffer> buf = encoder->FlushValues();
+
+ std::vector<ByteArray> values;
+ values.resize(array->length());
+ for (auto _ : state) {
+ auto decoder = MakeTypedDecoder<ByteArrayType>(encoding);
+ decoder->SetData(static_cast<int>(array->length()), buf->data(),
+ static_cast<int>(buf->size()));
+ decoder->Decode(values.data(), static_cast<int>(values.size()));
+ ::benchmark::DoNotOptimize(values);
+ }
+ state.SetItemsProcessed(state.iterations() * array->length());
+ state.counters["byte_array_bytes"] =
+ state.iterations() * array_actual->total_values_length();
+}
+
+static void BM_PlainDecodingByteArray(benchmark::State& state) {
+ DecodingByteArrayBenchmark(state, Encoding::PLAIN);
+}
+
+static void BM_DeltaBitLengthDecodingByteArray(benchmark::State& state) {
+ DecodingByteArrayBenchmark(state, Encoding::DELTA_LENGTH_BYTE_ARRAY);
+}
+
+BENCHMARK(BM_PlainEncodingByteArray)->Range(8, 1024);
+BENCHMARK(BM_DeltaBitLengthEncodingByteArray)->Range(8, 1024);
+BENCHMARK(BM_PlainDecodingByteArray)->Range(8, 1024);
+BENCHMARK(BM_DeltaBitLengthDecodingByteArray)->Range(8, 1024);
+
+static void BM_DecodingByteArraySpaced(benchmark::State& state, Encoding::type encoding) {
+ const int num_values = 1024;
+ const double null_percent = 0.02;
+
+ auto rand = ::arrow::random::RandomArrayGenerator(0);
+ int32_t max_length = state.range(0);
+ const auto array = rand.String(num_values, /* min_length */ 0,
+ /* max_length */ max_length, null_percent);
+ const auto valid_bits = array->null_bitmap_data();
+ const int null_count = static_cast<int>(array->null_count());
+ const auto array_actual =
+ ::arrow::internal::checked_pointer_cast<::arrow::StringArray>(array);
+
+ std::vector<ByteArray> byte_arrays;
+ byte_arrays.reserve(array_actual->length());
+ for (int i = 0; i < array_actual->length(); ++i) {
+ byte_arrays.emplace_back(array_actual->GetView(i));
+ }
+
+ auto encoder = MakeTypedEncoder<ByteArrayType>(encoding);
+ encoder->PutSpaced(byte_arrays.data(), num_values, valid_bits, 0);
+ std::shared_ptr<Buffer> buf = encoder->FlushValues();
+
+ auto decoder = MakeTypedDecoder<ByteArrayType>(encoding);
+ std::vector<uint8_t> decode_values(num_values * sizeof(ByteArray));
+ auto decode_buf = reinterpret_cast<ByteArray*>(decode_values.data());
+ for (auto _ : state) {
+ decoder->SetData(num_values - null_count, buf->data(), static_cast<int>(buf->size()));
+ decoder->DecodeSpaced(decode_buf, num_values, null_count, valid_bits, 0);
+ ::benchmark::DoNotOptimize(decode_buf);
+ }
+ state.counters["null_percent"] = null_percent * 100;
Review Comment:
`"null_percent"` is already widely used. So keep them equal
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] mapleFU commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1448016619
@pitrou benchmark input changed, mind take a look?
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] pitrou commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1448379649
No, this is release mode. I'm showing `BM_DeltaLengthDecodingByteArray`, not encoding.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] mapleFU commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1455344037
Ping @pitrou :)
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] mapleFU commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1458582265
@wjones127 @rok Seems @pitrou doesn't have spare time? Should I wait for him or wait others to take a look at this patch?
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] mapleFU commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1458658020
On my MacOS, after change item processed to data + offset:
```
---------------------------------------------------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations UserCounters...
---------------------------------------------------------------------------------------------------------------------------------------
BM_PlainEncodingByteArray/max-string-length:8/batch-size:512 3659 ns 2745 ns 247512 bytes_per_second=1.38484G/s items_per_second=186.507M/s
BM_PlainEncodingByteArray/max-string-length:64/batch-size:512 7606 ns 5272 ns 126288 bytes_per_second=3.2833G/s items_per_second=97.122M/s
BM_PlainEncodingByteArray/max-string-length:1024/batch-size:512 85815 ns 62674 ns 12375 bytes_per_second=4.04123G/s items_per_second=8.1692M/s
BM_PlainEncodingByteArray/max-string-length:8/batch-size:2048 13546 ns 12073 ns 51654 bytes_per_second=1.2649G/s items_per_second=169.637M/s
BM_PlainEncodingByteArray/max-string-length:64/batch-size:2048 62743 ns 47676 ns 14871 bytes_per_second=1.42196G/s items_per_second=42.9562M/s
BM_PlainEncodingByteArray/max-string-length:1024/batch-size:2048 239524 ns 208403 ns 3173 bytes_per_second=4.79258G/s items_per_second=9.82709M/s
BM_DeltaLengthEncodingByteArray/max-string-length:8/batch-size:512 6249 ns 6093 ns 114491 bytes_per_second=638.957M/s items_per_second=84.0366M/s
BM_DeltaLengthEncodingByteArray/max-string-length:64/batch-size:512 8451 ns 7496 ns 98549 bytes_per_second=2.30901G/s items_per_second=68.3018M/s
BM_DeltaLengthEncodingByteArray/max-string-length:1024/batch-size:512 82397 ns 68114 ns 9823 bytes_per_second=3.7185G/s items_per_second=7.51683M/s
BM_DeltaLengthEncodingByteArray/max-string-length:8/batch-size:2048 26286 ns 25109 ns 27493 bytes_per_second=622.771M/s items_per_second=81.5632M/s
BM_DeltaLengthEncodingByteArray/max-string-length:64/batch-size:2048 55228 ns 52277 ns 13039 bytes_per_second=1.29682G/s items_per_second=39.176M/s
BM_DeltaLengthEncodingByteArray/max-string-length:1024/batch-size:2048 250357 ns 235479 ns 3064 bytes_per_second=4.24152G/s items_per_second=8.69715M/s
BM_PlainDecodingByteArray/max-string-length:8/batch-size:512 1175 ns 1139 ns 621085 bytes_per_second=3.33662G/s items_per_second=449.369M/s
BM_PlainDecodingByteArray/max-string-length:64/batch-size:512 1213 ns 1143 ns 612584 bytes_per_second=15.1485G/s items_per_second=448.102M/s
BM_PlainDecodingByteArray/max-string-length:1024/batch-size:512 1167 ns 1140 ns 617573 bytes_per_second=222.27G/s items_per_second=449.311M/s
BM_PlainDecodingByteArray/max-string-length:8/batch-size:2048 4436 ns 4248 ns 164415 bytes_per_second=3.59507G/s items_per_second=482.14M/s
BM_PlainDecodingByteArray/max-string-length:64/batch-size:2048 4248 ns 4204 ns 156082 bytes_per_second=16.1272G/s items_per_second=487.192M/s
BM_PlainDecodingByteArray/max-string-length:1024/batch-size:2048 13921 ns 13883 ns 49055 bytes_per_second=71.9418G/s items_per_second=147.515M/s
BM_DeltaLengthDecodingByteArray/max-string-length:8/batch-size:512 1965 ns 1959 ns 356100 bytes_per_second=1.941G/s items_per_second=261.41M/s
BM_DeltaLengthDecodingByteArray/max-string-length:64/batch-size:512 5069 ns 5056 ns 139135 bytes_per_second=3.42333G/s items_per_second=101.264M/s
BM_DeltaLengthDecodingByteArray/max-string-length:1024/batch-size:512 84992 ns 82547 ns 8386 bytes_per_second=3.06834G/s items_per_second=6.20254M/s
BM_DeltaLengthDecodingByteArray/max-string-length:8/batch-size:2048 5911 ns 5891 ns 119511 bytes_per_second=2.59217G/s items_per_second=347.639M/s
BM_DeltaLengthDecodingByteArray/max-string-length:64/batch-size:2048 26904 ns 26252 ns 26404 bytes_per_second=2.58242G/s items_per_second=78.0131M/s
BM_DeltaLengthDecodingByteArray/max-string-length:1024/batch-size:2048 325519 ns 315624 ns 2253 bytes_per_second=3.16449G/s items_per_second=6.48873M/s
BM_PlainDecodingSpacedByteArray/max-string-length:8/batch-size:512 1177 ns 1168 ns 607813 bytes_per_second=3.2343G/s items_per_second=438.381M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:64/batch-size:512 1257 ns 1187 ns 594091 bytes_per_second=14.3557G/s items_per_second=431.357M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:1024/batch-size:512 1182 ns 1174 ns 594813 bytes_per_second=212.096G/s items_per_second=436.195M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:8/batch-size:2048 4985 ns 4728 ns 149907 bytes_per_second=3.20624G/s items_per_second=433.189M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:64/batch-size:2048 4612 ns 4604 ns 150540 bytes_per_second=14.4954G/s items_per_second=444.8M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:1024/batch-size:2048 13125 ns 13113 ns 52987 bytes_per_second=74.9127G/s items_per_second=156.179M/s null_percent=2
BM_DeltaLengthDecodingSpacedByteArray/max-string-length:8/batch-size:512 1647 ns 1647 ns 418708 bytes_per_second=2.29284G/s items_per_second=310.775M/s null_percent=2
BM_DeltaLengthDecodingSpacedByteArray/max-string-length:64/batch-size:512 4548 ns 4547 ns 153156 bytes_per_second=3.74715G/s items_per_second=112.594M/s null_percent=2
BM_DeltaLengthDecodingSpacedByteArray/max-string-length:1024/batch-size:512 55928 ns 55923 ns 12517 bytes_per_second=4.45176G/s items_per_second=9.15545M/s null_percent=2
BM_DeltaLengthDecodingSpacedByteArray/max-string-length:8/batch-size:2048 5834 ns 5833 ns 120996 bytes_per_second=2.59892G/s items_per_second=351.135M/s null_percent=2
BM_DeltaLengthDecodingSpacedByteArray/max-string-length:64/batch-size:2048 17598 ns 17568 ns 39706 bytes_per_second=3.79911G/s items_per_second=116.578M/s null_percent=2
BM_DeltaLengthDecodingSpacedByteArray/max-string-length:1024/batch-size:2048 220807 ns 220793 ns 3181 bytes_per_second=4.44916G/s items_per_second=9.27566M/s null_percent=2
BM_DictDecodingByteArray/max-string-length:8/batch-size:512 3380 ns 3380 ns 206645 bytes_per_second=1.12489G/s items_per_second=151.498M/s
BM_DictDecodingByteArray/max-string-length:64/batch-size:512 4823 ns 4822 ns 145563 bytes_per_second=3.58935G/s items_per_second=106.175M/s
BM_DictDecodingByteArray/max-string-length:1024/batch-size:512 32011 ns 31901 ns 21840 bytes_per_second=7.93962G/s items_per_second=16.0497M/s
BM_DictDecodingByteArray/max-string-length:8/batch-size:2048 10664 ns 10618 ns 65184 bytes_per_second=1.43825G/s items_per_second=192.886M/s
BM_DictDecodingByteArray/max-string-length:64/batch-size:2048 29204 ns 29138 ns 23638 bytes_per_second=2.32661G/s items_per_second=70.2853M/s
BM_DictDecodingByteArray/max-string-length:1024/batch-size:2048 139016 ns 138991 ns 5120 bytes_per_second=7.18603G/s items_per_second=14.7348M/s
```
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] mapleFU commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1447938782
Okay, I'll
1. Test Processing max-length: 8, 64, 1024
2. Batch-size (num string processed): 512, 1024, 2048
3. `"byte_array_bytes"` means the accumulated length of string a benchmark processed.
Do you think above argument is ok? Or it's still too much testcases? @pitrou
(Personally, I just use `benchmark_filter` to run the case I expect to run )
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] pitrou commented on a diff in pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on code in PR #34323:
URL: https://github.com/apache/arrow/pull/34323#discussion_r1120118208
##########
cpp/src/parquet/encoding_benchmark.cc:
##########
@@ -569,6 +569,133 @@ BENCHMARK(BM_DeltaBitPackingDecode_Int64_Narrow)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int32_Wide)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int64_Wide)->Range(MIN_RANGE, MAX_RANGE);
+static void ByteArrayCustomArguments(benchmark::internal::Benchmark* b) {
+ b->ArgsProduct({{8, 64, 1024}, {512, 2048}})
+ ->ArgNames({"max-string-length", "batch-size"});
+}
+
+void EncodingByteArrayBenchmark(benchmark::State& state, Encoding::type encoding) {
+ ::arrow::random::RandomArrayGenerator rag(0);
+ // Using arrow generator to generate random data.
+ int32_t max_length = static_cast<int32_t>(state.range(0));
+ int32_t array_size = static_cast<int32_t>(state.range(1));
+ auto array =
+ rag.String(/* size */ array_size, /* min_length */ 0, /* max_length */ max_length,
+ /* null_probability */ 0);
+ const auto array_actual =
+ ::arrow::internal::checked_pointer_cast<::arrow::StringArray>(array);
+ auto encoder = MakeTypedEncoder<ByteArrayType>(encoding);
+ std::vector<ByteArray> values;
+ for (int i = 0; i < array_actual->length(); ++i) {
+ values.emplace_back(array_actual->GetView(i));
+ }
+
+ for (auto _ : state) {
+ encoder->Put(values.data(), static_cast<int>(values.size()));
+ encoder->FlushValues();
+ }
+ state.SetItemsProcessed(state.iterations() * array_actual->length());
+ state.counters["byte_array_bytes"] =
+ static_cast<double>(state.iterations() * array_actual->total_values_length());
+}
+
+static void BM_DeltaBitLengthEncodingByteArray(benchmark::State& state) {
+ EncodingByteArrayBenchmark(state, Encoding::DELTA_LENGTH_BYTE_ARRAY);
+}
+
+static void BM_PlainEncodingByteArray(benchmark::State& state) {
+ EncodingByteArrayBenchmark(state, Encoding::PLAIN);
+}
+
+void DecodingByteArrayBenchmark(benchmark::State& state, Encoding::type encoding) {
+ ::arrow::random::RandomArrayGenerator rag(0);
+ int32_t max_length = static_cast<int32_t>(state.range(0));
+ int32_t array_size = static_cast<int32_t>(state.range(1));
+ // Using arrow to write, because we just benchmark decoding here.
+ auto array =
+ rag.String(/* size */ array_size, /* min_length */ 0, /* max_length */ max_length,
+ /* null_probability */ 0);
+ const auto array_actual =
+ ::arrow::internal::checked_pointer_cast<::arrow::StringArray>(array);
+ auto encoder = MakeTypedEncoder<ByteArrayType>(encoding);
+ encoder->Put(*array);
+ std::shared_ptr<Buffer> buf = encoder->FlushValues();
+
+ std::vector<ByteArray> values;
+ values.resize(array->length());
+ for (auto _ : state) {
+ auto decoder = MakeTypedDecoder<ByteArrayType>(encoding);
+ decoder->SetData(static_cast<int>(array->length()), buf->data(),
+ static_cast<int>(buf->size()));
+ decoder->Decode(values.data(), static_cast<int>(values.size()));
+ ::benchmark::DoNotOptimize(values);
+ }
+ state.SetItemsProcessed(state.iterations() * array->length());
+ state.counters["byte_array_bytes"] =
+ static_cast<double>(state.iterations() * array_actual->total_values_length());
Review Comment:
Same here
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] mapleFU commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1444041796
After using `UnsafeAppend` for continous string on my MacOS with Release(O2):
```
BM_PlainEncodingByteArray 104785 ns 104771 ns 6608 byte_array_bytes=3.49835G items_per_second=9.77369M/s
BM_DeltaBitLengthEncodingByteArray 104361 ns 104324 ns 7083 byte_array_bytes=3.74982G items_per_second=9.81556M/s
```
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] mapleFU commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1449208641
Waiting for pitrou see and merge it
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] rok commented on a diff in pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "rok (via GitHub)" <gi...@apache.org>.
rok commented on code in PR #34323:
URL: https://github.com/apache/arrow/pull/34323#discussion_r1119457715
##########
cpp/src/parquet/encoding_benchmark.cc:
##########
@@ -569,6 +569,126 @@ BENCHMARK(BM_DeltaBitPackingDecode_Int64_Narrow)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int32_Wide)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int64_Wide)->Range(MIN_RANGE, MAX_RANGE);
+void EncodingByteArrayBenchmark(benchmark::State& state, Encoding::type encoding) {
+ ::arrow::random::RandomArrayGenerator rag(0);
+ // Using arrow generator to generate random data.
+ int32_t max_length = state.range(0);
+ auto array =
+ rag.String(/* size */ 1024, /* min_length */ 0, /* max_length */ max_length,
Review Comment:
I'd add different options only if there is nonlinear behavior (time complexity != O(n)).
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] mapleFU commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1447862030
On my MacOS (Release, O2), The benchmark data is listed below:
```
------------------------------------------------------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations UserCounters...
------------------------------------------------------------------------------------------------------------------------------------------
BM_PlainEncodingByteArray/max-string-length:8/batch-size:8 232 ns 225 ns 3022453 byte_array_bytes=102.763M items_per_second=35.5149M/s
BM_PlainEncodingByteArray/max-string-length:64/batch-size:8 381 ns 360 ns 1811055 byte_array_bytes=572.293M items_per_second=22.1969M/s
BM_PlainEncodingByteArray/max-string-length:512/batch-size:8 392 ns 371 ns 1889288 byte_array_bytes=3.39694G items_per_second=21.5478M/s
BM_PlainEncodingByteArray/max-string-length:1024/batch-size:8 559 ns 405 ns 1774812 byte_array_bytes=4.2063G items_per_second=19.7748M/s
BM_PlainEncodingByteArray/max-string-length:8/batch-size:64 581 ns 567 ns 1194641 byte_array_bytes=324.942M items_per_second=112.875M/s
BM_PlainEncodingByteArray/max-string-length:64/batch-size:64 866 ns 826 ns 858727 byte_array_bytes=1.65219G items_per_second=77.4757M/s
BM_PlainEncodingByteArray/max-string-length:512/batch-size:64 2176 ns 1847 ns 380963 byte_array_bytes=6.39751G items_per_second=34.6493M/s
BM_PlainEncodingByteArray/max-string-length:1024/batch-size:64 8308 ns 7645 ns 83627 byte_array_bytes=2.73009G items_per_second=8.37161M/s
BM_PlainEncodingByteArray/max-string-length:8/batch-size:512 2650 ns 2271 ns 310009 byte_array_bytes=629.318M items_per_second=225.464M/s
BM_PlainEncodingByteArray/max-string-length:64/batch-size:512 4756 ns 4330 ns 166212 byte_array_bytes=2.74798G items_per_second=118.257M/s
BM_PlainEncodingByteArray/max-string-length:512/batch-size:512 35018 ns 22826 ns 33644 byte_array_bytes=4.33981G items_per_second=22.4305M/s
BM_PlainEncodingByteArray/max-string-length:1024/batch-size:512 92174 ns 58823 ns 10894 byte_array_bytes=2.94037G items_per_second=8.70401M/s
BM_PlainEncodingByteArray/max-string-length:8/batch-size:1024 5391 ns 4817 ns 150021 byte_array_bytes=615.686M items_per_second=212.598M/s
BM_PlainEncodingByteArray/max-string-length:64/batch-size:1024 36417 ns 23642 ns 29181 byte_array_bytes=948.178M items_per_second=43.3121M/s
BM_PlainEncodingByteArray/max-string-length:512/batch-size:1024 85629 ns 61656 ns 12154 byte_array_bytes=3.21259G items_per_second=16.6084M/s
BM_PlainEncodingByteArray/max-string-length:1024/batch-size:1024 141107 ns 94402 ns 8105 byte_array_bytes=4.29088G items_per_second=10.8472M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:8/batch-size:8 1046 ns 863 ns 833701 byte_array_bytes=28.3458M items_per_second=9.26964M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:64/batch-size:8 973 ns 889 ns 740874 byte_array_bytes=234.116M items_per_second=8.99963M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:512/batch-size:8 912 ns 896 ns 788288 byte_array_bytes=1.41734G items_per_second=8.92573M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:1024/batch-size:8 1616 ns 944 ns 741400 byte_array_bytes=1.75712G items_per_second=8.47645M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:8/batch-size:64 1565 ns 1257 ns 533406 byte_array_bytes=145.086M items_per_second=50.9163M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:64/batch-size:64 1450 ns 1387 ns 486760 byte_array_bytes=936.526M items_per_second=46.1519M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:512/batch-size:64 1864 ns 1680 ns 414889 byte_array_bytes=6.96723G items_per_second=38.0996M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:1024/batch-size:64 11252 ns 7993 ns 86020 byte_array_bytes=2.80821G items_per_second=8.0066M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:8/batch-size:512 10041 ns 6344 ns 113362 byte_array_bytes=230.125M items_per_second=80.7069M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:64/batch-size:512 16536 ns 8163 ns 87860 byte_array_bytes=1.45259G items_per_second=62.7218M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:512/batch-size:512 65721 ns 38761 ns 17499 byte_array_bytes=2.25723G items_per_second=13.2092M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:1024/batch-size:512 74197 ns 64272 ns 10058 byte_array_bytes=2.71472G items_per_second=7.96615M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:8/batch-size:1024 13742 ns 11885 ns 59584 byte_array_bytes=244.533M items_per_second=86.1562M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:64/batch-size:1024 22462 ns 20930 ns 32935 byte_array_bytes=1070.16M items_per_second=48.9251M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:512/batch-size:1024 80715 ns 67411 ns 10726 byte_array_bytes=2.83514G items_per_second=15.1904M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:1024/batch-size:1024 128199 ns 117455 ns 6039 byte_array_bytes=3.19711G items_per_second=8.7182M/s
BM_PlainDecodingByteArray/max-string-length:8/batch-size:8 256 ns 123 ns 5913111 byte_array_bytes=201.046M items_per_second=64.8759M/s
BM_PlainDecodingByteArray/max-string-length:64/batch-size:8 158 ns 123 ns 5570720 byte_array_bytes=1.76035G items_per_second=65.1342M/s
BM_PlainDecodingByteArray/max-string-length:512/batch-size:8 254 ns 130 ns 5322142 byte_array_bytes=9.56921G items_per_second=61.4826M/s
BM_PlainDecodingByteArray/max-string-length:1024/batch-size:8 148 ns 122 ns 5744485 byte_array_bytes=13.6144G items_per_second=65.8011M/s
BM_PlainDecodingByteArray/max-string-length:8/batch-size:64 311 ns 229 ns 2963139 byte_array_bytes=805.974M items_per_second=279.71M/s
BM_PlainDecodingByteArray/max-string-length:64/batch-size:64 503 ns 246 ns 2926054 byte_array_bytes=5.62973G items_per_second=259.774M/s
BM_PlainDecodingByteArray/max-string-length:512/batch-size:64 453 ns 233 ns 3013981 byte_array_bytes=50.6138G items_per_second=274.626M/s
BM_PlainDecodingByteArray/max-string-length:1024/batch-size:64 281 ns 227 ns 3054781 byte_array_bytes=99.7264G items_per_second=281.48M/s
BM_PlainDecodingByteArray/max-string-length:8/batch-size:512 1374 ns 1139 ns 621300 byte_array_bytes=1.26124G items_per_second=449.385M/s
BM_PlainDecodingByteArray/max-string-length:64/batch-size:512 1215 ns 1128 ns 616974 byte_array_bytes=10.2004G items_per_second=453.999M/s
BM_PlainDecodingByteArray/max-string-length:512/batch-size:512 1194 ns 1129 ns 617660 byte_array_bytes=79.6732G items_per_second=453.453M/s
BM_PlainDecodingByteArray/max-string-length:1024/batch-size:512 1245 ns 1145 ns 608257 byte_array_bytes=164.173G items_per_second=447.216M/s
BM_PlainDecodingByteArray/max-string-length:8/batch-size:1024 2283 ns 2161 ns 323530 byte_array_bytes=1.32777G items_per_second=473.9M/s
BM_PlainDecodingByteArray/max-string-length:64/batch-size:1024 2477 ns 2185 ns 316713 byte_array_bytes=10.291G items_per_second=468.553M/s
BM_PlainDecodingByteArray/max-string-length:512/batch-size:1024 3749 ns 3404 ns 221881 byte_array_bytes=58.6485G items_per_second=300.795M/s
BM_PlainDecodingByteArray/max-string-length:1024/batch-size:1024 3304 ns 3131 ns 228212 byte_array_bytes=120.818G items_per_second=327.032M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:8/batch-size:8 707 ns 660 ns 1064882 byte_array_bytes=36.206M items_per_second=12.1214M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:64/batch-size:8 819 ns 743 ns 939270 byte_array_bytes=296.809M items_per_second=10.7671M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:512/batch-size:8 1112 ns 1068 ns 668239 byte_array_bytes=1.20149G items_per_second=7.48772M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:1024/batch-size:8 1877 ns 1205 ns 580662 byte_array_bytes=1.37617G items_per_second=6.63671M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:8/batch-size:64 1594 ns 875 ns 826007 byte_array_bytes=224.674M items_per_second=73.1097M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:64/batch-size:64 3203 ns 1314 ns 538168 byte_array_bytes=1035.44M items_per_second=48.6918M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:512/batch-size:64 8250 ns 4592 ns 149775 byte_array_bytes=2.51517G items_per_second=13.936M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:1024/batch-size:64 8982 ns 8156 ns 84696 byte_array_bytes=2.76499G items_per_second=7.84693M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:8/batch-size:512 2338 ns 2004 ns 342736 byte_array_bytes=695.754M items_per_second=255.459M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:64/batch-size:512 6882 ns 5160 ns 134520 byte_array_bytes=2.22402G items_per_second=99.2298M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:512/batch-size:512 48172 ns 42834 ns 16457 byte_array_bytes=2.12282G items_per_second=11.9532M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:1024/batch-size:512 93072 ns 84807 ns 8119 byte_array_bytes=2.19137G items_per_second=6.03726M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:8/batch-size:1024 3426 ns 3299 ns 212892 byte_array_bytes=873.709M items_per_second=310.357M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:64/batch-size:1024 10985 ns 9619 ns 72798 byte_array_bytes=2.36543G items_per_second=106.452M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:512/batch-size:1024 98226 ns 84960 ns 7963 byte_array_bytes=2.10481G items_per_second=12.0528M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:1024/batch-size:1024 177549 ns 162144 ns 4238 byte_array_bytes=2.24364G items_per_second=6.31537M/s
BM_PlainDecodingSpacedByteArray/max-string-length:8/batch-size:8 12.7 ns 11.0 ns 64128403 byte_array_bytes=2.18037G items_per_second=729.143M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:64/batch-size:8 11.4 ns 11.1 ns 64161320 byte_array_bytes=20.275G items_per_second=717.85M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:512/batch-size:8 11.8 ns 11.0 ns 63516260 byte_array_bytes=114.202G items_per_second=727.659M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:1024/batch-size:8 11.6 ns 10.9 ns 63247106 byte_array_bytes=149.896G items_per_second=732.698M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:8/batch-size:64 163 ns 148 ns 4785899 byte_array_bytes=1.28741G items_per_second=433.737M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:64/batch-size:64 156 ns 147 ns 4816028 byte_array_bytes=9.08303G items_per_second=434.403M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:512/batch-size:64 155 ns 148 ns 4699974 byte_array_bytes=77.4368G items_per_second=433.89M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:1024/batch-size:64 162 ns 147 ns 4757439 byte_array_bytes=151.524G items_per_second=435.608M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:8/batch-size:512 1557 ns 1180 ns 591206 byte_array_bytes=1.18478G items_per_second=433.945M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:64/batch-size:512 1900 ns 1180 ns 597229 byte_array_bytes=9.70139G items_per_second=433.919M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:512/batch-size:512 1429 ns 1205 ns 589126 byte_array_bytes=74.5268G items_per_second=424.846M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:1024/batch-size:512 1460 ns 1181 ns 583737 byte_array_bytes=154.843G items_per_second=433.68M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:8/batch-size:1024 3566 ns 2371 ns 298623 byte_array_bytes=1.20345G items_per_second=431.809M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:64/batch-size:1024 2849 ns 2375 ns 297415 byte_array_bytes=9.43995G items_per_second=431.244M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:512/batch-size:1024 3283 ns 3177 ns 205213 byte_array_bytes=53.0954G items_per_second=322.28M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:1024/batch-size:1024 3438 ns 3168 ns 207618 byte_array_bytes=107.9G items_per_second=323.184M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:8/batch-size:8 277 ns 272 ns 2561288 byte_array_bytes=87.0838M items_per_second=29.4251M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:64/batch-size:8 358 ns 336 ns 2071515 byte_array_bytes=654.599M items_per_second=23.821M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:512/batch-size:8 722 ns 668 ns 1074130 byte_array_bytes=1.93129G items_per_second=11.9811M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:1024/batch-size:8 1016 ns 785 ns 889555 byte_array_bytes=2.10825G items_per_second=10.1966M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:8/batch-size:64 570 ns 464 ns 1495905 byte_array_bytes=402.398M items_per_second=137.879M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:64/batch-size:64 1438 ns 882 ns 777191 byte_array_bytes=1.46578G items_per_second=72.5908M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:512/batch-size:64 5028 ns 4223 ns 174233 byte_array_bytes=2.87066G items_per_second=15.1537M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:1024/batch-size:64 10117 ns 7722 ns 93772 byte_array_bytes=2.98664G items_per_second=8.28773M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:8/batch-size:512 2376 ns 1847 ns 374630 byte_array_bytes=750.759M items_per_second=277.219M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:64/batch-size:512 5869 ns 5032 ns 137120 byte_array_bytes=2.22738G items_per_second=101.748M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:512/batch-size:512 34159 ns 29866 ns 23196 byte_array_bytes=2.93439G items_per_second=17.1431M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:1024/batch-size:512 87013 ns 62364 ns 11585 byte_array_bytes=3.07306G items_per_second=8.20986M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:8/batch-size:1024 7735 ns 3339 ns 207524 byte_array_bytes=836.322M items_per_second=306.706M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:64/batch-size:1024 31625 ns 9976 ns 74317 byte_array_bytes=2.35882G items_per_second=102.651M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:512/batch-size:1024 85861 ns 60491 ns 11059 byte_array_bytes=2.86133G items_per_second=16.9282M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:1024/batch-size:1024 285944 ns 121163 ns 5646 byte_array_bytes=2.93425G items_per_second=8.4514M/s null_percent=2
BM_DictDecodingByteArray/max-string-length:8/batch-size:8 1130 ns 907 ns 751581 bytes_per_second=134.536M/s
BM_DictDecodingByteArray/max-string-length:64/batch-size:8 1613 ns 957 ns 739325 bytes_per_second=1020.8M/s
BM_DictDecodingByteArray/max-string-length:512/batch-size:8 1424 ns 936 ns 724840 bytes_per_second=8.15314G/s
BM_DictDecodingByteArray/max-string-length:1024/batch-size:8 1793 ns 970 ns 685334 bytes_per_second=15.7286G/s
BM_DictDecodingByteArray/max-string-length:8/batch-size:64 3146 ns 1247 ns 582571 bytes_per_second=97.8792M/s
BM_DictDecodingByteArray/max-string-length:64/batch-size:64 1914 ns 1374 ns 493135 bytes_per_second=710.58M/s
BM_DictDecodingByteArray/max-string-length:512/batch-size:64 2297 ns 1422 ns 486561 bytes_per_second=5.36377G/s
BM_DictDecodingByteArray/max-string-length:1024/batch-size:64 3335 ns 1736 ns 371290 bytes_per_second=8.7906G/s
BM_DictDecodingByteArray/max-string-length:8/batch-size:512 4913 ns 3702 ns 193253 bytes_per_second=32.9777M/s
BM_DictDecodingByteArray/max-string-length:64/batch-size:512 8259 ns 5124 ns 129805 bytes_per_second=190.597M/s
BM_DictDecodingByteArray/max-string-length:512/batch-size:512 35667 ns 22863 ns 31428 bytes_per_second=341.708M/s
BM_DictDecodingByteArray/max-string-length:1024/batch-size:512 65137 ns 41063 ns 17495 bytes_per_second=380.511M/s
BM_DictDecodingByteArray/max-string-length:8/batch-size:1024 8271 ns 6479 ns 106875 bytes_per_second=18.8402M/s
BM_DictDecodingByteArray/max-string-length:64/batch-size:1024 11164 ns 9908 ns 69036 bytes_per_second=98.5611M/s
BM_DictDecodingByteArray/max-string-length:512/batch-size:1024 64305 ns 47617 ns 15519 bytes_per_second=164.07M/s
BM_DictDecodingByteArray/max-string-length:1024/batch-size:1024 104702 ns 86237 ns 7481 bytes_per_second=181.187M/s
➜ cpp git:(parquet/benchmark-delta-length-byte) ✗ .//cmake-build-release/release/parquet-encoding-benchmark --benchmark_filter=ByteArray
Unable to determine clock rate from sysctl: hw.cpufrequency: No such file or directory
This does not affect benchmark measurements, only the metadata output.
2023-02-28T17:35:35+08:00
Running .//cmake-build-release/release/parquet-encoding-benchmark
Run on (10 X 24.1204 MHz CPU s)
CPU Caches:
L1 Data 64 KiB
L1 Instruction 128 KiB
L2 Unified 4096 KiB (x10)
Load Average: 16.90, 14.64, 11.34
------------------------------------------------------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations UserCounters...
------------------------------------------------------------------------------------------------------------------------------------------
BM_PlainEncodingByteArray/max-string-length:8/batch-size:8 220 ns 219 ns 3144273 byte_array_bytes=106.905M items_per_second=36.5007M/s
BM_PlainEncodingByteArray/max-string-length:64/batch-size:8 338 ns 338 ns 2076455 byte_array_bytes=656.16M items_per_second=23.6708M/s
BM_PlainEncodingByteArray/max-string-length:512/batch-size:8 348 ns 348 ns 2001109 byte_array_bytes=3.59799G items_per_second=22.9709M/s
BM_PlainEncodingByteArray/max-string-length:1024/batch-size:8 364 ns 364 ns 1925267 byte_array_bytes=4.56288G items_per_second=21.9665M/s
BM_PlainEncodingByteArray/max-string-length:8/batch-size:64 545 ns 545 ns 1281605 byte_array_bytes=348.597M items_per_second=117.448M/s
BM_PlainEncodingByteArray/max-string-length:64/batch-size:64 776 ns 776 ns 894889 byte_array_bytes=1.72177G items_per_second=82.456M/s
BM_PlainEncodingByteArray/max-string-length:512/batch-size:64 1702 ns 1701 ns 415692 byte_array_bytes=6.98072G items_per_second=37.615M/s
BM_PlainEncodingByteArray/max-string-length:1024/batch-size:64 6510 ns 6491 ns 102760 byte_array_bytes=3.3547G items_per_second=9.86018M/s
BM_PlainEncodingByteArray/max-string-length:8/batch-size:512 2133 ns 2133 ns 327217 byte_array_bytes=664.251M items_per_second=240.023M/s
BM_PlainEncodingByteArray/max-string-length:64/batch-size:512 3982 ns 3981 ns 176819 byte_array_bytes=2.92335G items_per_second=128.611M/s
BM_PlainEncodingByteArray/max-string-length:512/batch-size:512 25961 ns 25867 ns 27286 byte_array_bytes=3.51968G items_per_second=19.7937M/s
BM_PlainEncodingByteArray/max-string-length:1024/batch-size:512 52750 ns 52662 ns 13091 byte_array_bytes=3.53335G items_per_second=9.72236M/s
BM_PlainEncodingByteArray/max-string-length:8/batch-size:1024 4478 ns 4477 ns 156534 byte_array_bytes=642.416M items_per_second=228.725M/s
BM_PlainEncodingByteArray/max-string-length:64/batch-size:1024 17840 ns 17837 ns 40012 byte_array_bytes=1.30011G items_per_second=57.408M/s
BM_PlainEncodingByteArray/max-string-length:512/batch-size:1024 61399 ns 61230 ns 10723 byte_array_bytes=2.83435G items_per_second=16.7239M/s
BM_PlainEncodingByteArray/max-string-length:1024/batch-size:1024 97665 ns 88377 ns 8443 byte_array_bytes=4.46982G items_per_second=11.5867M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:8/batch-size:8 687 ns 686 ns 1012937 byte_array_bytes=34.4399M items_per_second=11.6583M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:64/batch-size:8 720 ns 720 ns 969355 byte_array_bytes=306.316M items_per_second=11.1139M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:512/batch-size:8 736 ns 736 ns 933234 byte_array_bytes=1.67795G items_per_second=10.8697M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:1024/batch-size:8 755 ns 755 ns 921380 byte_array_bytes=2.18367G items_per_second=10.6019M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:8/batch-size:64 1169 ns 1169 ns 598153 byte_array_bytes=162.698M items_per_second=54.7687M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:64/batch-size:64 1307 ns 1306 ns 530669 byte_array_bytes=1021.01M items_per_second=48.9899M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:512/batch-size:64 1596 ns 1595 ns 436151 byte_array_bytes=7.32428G items_per_second=40.119M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:1024/batch-size:64 6344 ns 6343 ns 92768 byte_array_bytes=3.0285G items_per_second=10.0894M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:8/batch-size:512 5778 ns 5775 ns 121979 byte_array_bytes=247.617M items_per_second=88.6507M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:64/batch-size:512 6948 ns 6946 ns 100676 byte_array_bytes=1.66448G items_per_second=73.7086M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:512/batch-size:512 29502 ns 29427 ns 24241 byte_array_bytes=3.1269G items_per_second=17.3987M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:1024/batch-size:512 54483 ns 52994 ns 13812 byte_array_bytes=3.72796G items_per_second=9.66139M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:8/batch-size:1024 11674 ns 11486 ns 59506 byte_array_bytes=244.213M items_per_second=89.1551M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:64/batch-size:1024 19855 ns 19580 ns 35284 byte_array_bytes=1.14648G items_per_second=52.2988M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:512/batch-size:1024 62941 ns 61977 ns 10979 byte_array_bytes=2.90201G items_per_second=16.5223M/s
BM_DeltaBitLengthEncodingByteArray/max-string-length:1024/batch-size:1024 108902 ns 108043 ns 6303 byte_array_bytes=3.33688G items_per_second=9.47771M/s
BM_PlainDecodingByteArray/max-string-length:8/batch-size:8 114 ns 114 ns 6196006 byte_array_bytes=210.664M items_per_second=70.0129M/s
BM_PlainDecodingByteArray/max-string-length:64/batch-size:8 114 ns 114 ns 6130993 byte_array_bytes=1.93739G items_per_second=70.0853M/s
BM_PlainDecodingByteArray/max-string-length:512/batch-size:8 114 ns 114 ns 6164631 byte_array_bytes=11.084G items_per_second=70.0387M/s
BM_PlainDecodingByteArray/max-string-length:1024/batch-size:8 114 ns 114 ns 6087380 byte_array_bytes=14.4271G items_per_second=70.1922M/s
BM_PlainDecodingByteArray/max-string-length:8/batch-size:64 219 ns 218 ns 3163170 byte_array_bytes=860.382M items_per_second=292.95M/s
BM_PlainDecodingByteArray/max-string-length:64/batch-size:64 219 ns 219 ns 3176116 byte_array_bytes=6.11085G items_per_second=292.202M/s
BM_PlainDecodingByteArray/max-string-length:512/batch-size:64 219 ns 219 ns 3206288 byte_array_bytes=53.8432G items_per_second=292.544M/s
BM_PlainDecodingByteArray/max-string-length:1024/batch-size:64 220 ns 219 ns 3175251 byte_array_bytes=103.659G items_per_second=291.598M/s
BM_PlainDecodingByteArray/max-string-length:8/batch-size:512 1078 ns 1077 ns 647261 byte_array_bytes=1.31394G items_per_second=475.324M/s
BM_PlainDecodingByteArray/max-string-length:64/batch-size:512 1090 ns 1089 ns 645191 byte_array_bytes=10.6669G items_per_second=470.223M/s
BM_PlainDecodingByteArray/max-string-length:512/batch-size:512 1080 ns 1079 ns 639001 byte_array_bytes=82.426G items_per_second=474.609M/s
BM_PlainDecodingByteArray/max-string-length:1024/batch-size:512 1090 ns 1088 ns 649899 byte_array_bytes=175.412G items_per_second=470.7M/s
BM_PlainDecodingByteArray/max-string-length:8/batch-size:1024 2064 ns 2061 ns 335247 byte_array_bytes=1.37585G items_per_second=496.859M/s
BM_PlainDecodingByteArray/max-string-length:64/batch-size:1024 2081 ns 2078 ns 336772 byte_array_bytes=10.9427G items_per_second=492.897M/s
BM_PlainDecodingByteArray/max-string-length:512/batch-size:1024 3405 ns 3398 ns 217596 byte_array_bytes=57.5158G items_per_second=301.397M/s
BM_PlainDecodingByteArray/max-string-length:1024/batch-size:1024 3079 ns 3054 ns 226165 byte_array_bytes=119.734G items_per_second=335.299M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:8/batch-size:8 646 ns 645 ns 1097850 byte_array_bytes=37.3269M items_per_second=12.4107M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:64/batch-size:8 705 ns 704 ns 968603 byte_array_bytes=306.079M items_per_second=11.3643M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:512/batch-size:8 1021 ns 1020 ns 675096 byte_array_bytes=1.21382G items_per_second=7.84478M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:1024/batch-size:8 1134 ns 1133 ns 623586 byte_array_bytes=1.4779G items_per_second=7.06317M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:8/batch-size:64 796 ns 795 ns 888088 byte_array_bytes=241.56M items_per_second=80.485M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:64/batch-size:64 1151 ns 1149 ns 604042 byte_array_bytes=1.16218G items_per_second=55.6956M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:512/batch-size:64 4291 ns 4281 ns 165188 byte_array_bytes=2.774G items_per_second=14.9509M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:1024/batch-size:64 7522 ns 7520 ns 91208 byte_array_bytes=2.97758G items_per_second=8.51017M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:8/batch-size:512 1913 ns 1911 ns 369723 byte_array_bytes=750.538M items_per_second=267.935M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:64/batch-size:512 4950 ns 4943 ns 142816 byte_array_bytes=2.36118G items_per_second=103.585M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:512/batch-size:512 42087 ns 41521 ns 17102 byte_array_bytes=2.20602G items_per_second=12.3312M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:1024/batch-size:512 80636 ns 80550 ns 8673 byte_array_bytes=2.3409G items_per_second=6.35627M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:8/batch-size:1024 3143 ns 3142 ns 222318 byte_array_bytes=912.393M items_per_second=325.868M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:64/batch-size:1024 9141 ns 9132 ns 76839 byte_array_bytes=2.49673G items_per_second=112.133M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:512/batch-size:1024 81776 ns 80464 ns 8812 byte_array_bytes=2.32922G items_per_second=12.7263M/s
BM_DeltaBitLengthDecodingByteArray/max-string-length:1024/batch-size:1024 153476 ns 152955 ns 4666 byte_array_bytes=2.47023G items_per_second=6.69478M/s
BM_PlainDecodingSpacedByteArray/max-string-length:8/batch-size:8 10.3 ns 10.3 ns 68499853 byte_array_bytes=2.329G items_per_second=780.444M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:64/batch-size:8 10.5 ns 10.5 ns 67042102 byte_array_bytes=21.1853G items_per_second=764.794M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:512/batch-size:8 10.8 ns 10.7 ns 66247729 byte_array_bytes=119.113G items_per_second=745.118M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:1024/batch-size:8 10.6 ns 10.5 ns 65701789 byte_array_bytes=155.713G items_per_second=759.172M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:8/batch-size:64 140 ns 140 ns 4934268 byte_array_bytes=1.32732G items_per_second=458.471M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:64/batch-size:64 139 ns 139 ns 5062193 byte_array_bytes=9.5473G items_per_second=460.233M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:512/batch-size:64 139 ns 139 ns 4997466 byte_array_bytes=82.3382G items_per_second=461.037M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:1024/batch-size:64 138 ns 138 ns 5004468 byte_array_bytes=159.392G items_per_second=462.485M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:8/batch-size:512 1110 ns 1109 ns 633072 byte_array_bytes=1.26868G items_per_second=461.636M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:64/batch-size:512 1112 ns 1111 ns 624197 byte_array_bytes=10.1395G items_per_second=460.741M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:512/batch-size:512 1121 ns 1120 ns 633909 byte_array_bytes=80.192G items_per_second=457.039M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:1024/batch-size:512 1115 ns 1113 ns 627100 byte_array_bytes=166.346G items_per_second=459.917M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:8/batch-size:1024 2224 ns 2222 ns 315318 byte_array_bytes=1.27073G items_per_second=460.776M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:64/batch-size:1024 2254 ns 2251 ns 315936 byte_array_bytes=10.0278G items_per_second=454.961M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:512/batch-size:1024 3601 ns 3597 ns 210198 byte_array_bytes=54.3852G items_per_second=284.682M/s null_percent=2
BM_PlainDecodingSpacedByteArray/max-string-length:1024/batch-size:1024 3042 ns 3036 ns 233833 byte_array_bytes=121.524G items_per_second=337.24M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:8/batch-size:8 259 ns 259 ns 2551904 byte_array_bytes=86.7647M items_per_second=30.907M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:64/batch-size:8 321 ns 321 ns 2185062 byte_array_bytes=690.48M items_per_second=24.9192M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:512/batch-size:8 624 ns 624 ns 1120897 byte_array_bytes=2.01537G items_per_second=12.8299M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:1024/batch-size:8 745 ns 742 ns 940645 byte_array_bytes=2.22933G items_per_second=10.7804M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:8/batch-size:64 438 ns 437 ns 1598652 byte_array_bytes=430.037M items_per_second=146.299M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:64/batch-size:64 783 ns 783 ns 885168 byte_array_bytes=1.66943G items_per_second=81.777M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:512/batch-size:64 3798 ns 3796 ns 184000 byte_array_bytes=3.03158G items_per_second=16.8605M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:1024/batch-size:64 6974 ns 6968 ns 100219 byte_array_bytes=3.19198G items_per_second=9.18541M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:8/batch-size:512 1656 ns 1654 ns 423462 byte_array_bytes=848.618M items_per_second=309.503M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:64/batch-size:512 4611 ns 4606 ns 151529 byte_array_bytes=2.46144G items_per_second=111.169M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:512/batch-size:512 27971 ns 27957 ns 25251 byte_array_bytes=3.19435G items_per_second=18.314M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:1024/batch-size:512 56651 ns 56621 ns 11990 byte_array_bytes=3.18049G items_per_second=9.04251M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:8/batch-size:1024 3055 ns 3053 ns 228572 byte_array_bytes=921.145M items_per_second=335.459M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:64/batch-size:1024 8739 ns 8736 ns 79527 byte_array_bytes=2.52419G items_per_second=117.21M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:512/batch-size:1024 56258 ns 56241 ns 12481 byte_array_bytes=3.22925G items_per_second=18.2075M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray/max-string-length:1024/batch-size:1024 110212 ns 110186 ns 6270 byte_array_bytes=3.25855G items_per_second=9.29335M/s null_percent=2
BM_DictDecodingByteArray/max-string-length:8/batch-size:8 854 ns 854 ns 817184 bytes_per_second=142.962M/s
BM_DictDecodingByteArray/max-string-length:64/batch-size:8 885 ns 885 ns 773259 bytes_per_second=1103.76M/s
BM_DictDecodingByteArray/max-string-length:512/batch-size:8 877 ns 877 ns 788342 bytes_per_second=8.70237G/s
BM_DictDecodingByteArray/max-string-length:1024/batch-size:8 894 ns 893 ns 786862 bytes_per_second=17.0789G/s
BM_DictDecodingByteArray/max-string-length:8/batch-size:64 1125 ns 1125 ns 624064 bytes_per_second=108.517M/s
BM_DictDecodingByteArray/max-string-length:64/batch-size:64 1289 ns 1287 ns 550674 bytes_per_second=758.585M/s
BM_DictDecodingByteArray/max-string-length:512/batch-size:64 1370 ns 1362 ns 515270 bytes_per_second=5.60083G/s
BM_DictDecodingByteArray/max-string-length:1024/batch-size:64 1755 ns 1658 ns 430348 bytes_per_second=9.2023G/s
BM_DictDecodingByteArray/max-string-length:8/batch-size:512 3557 ns 3486 ns 205670 bytes_per_second=35.0223M/s
BM_DictDecodingByteArray/max-string-length:64/batch-size:512 4888 ns 4866 ns 139860 bytes_per_second=200.677M/s
BM_DictDecodingByteArray/max-string-length:512/batch-size:512 22125 ns 21177 ns 33906 bytes_per_second=368.918M/s
BM_DictDecodingByteArray/max-string-length:1024/batch-size:512 35039 ns 34925 ns 19464 bytes_per_second=447.385M/s
BM_DictDecodingByteArray/max-string-length:8/batch-size:1024 5884 ns 5869 ns 119906 bytes_per_second=20.8004M/s
BM_DictDecodingByteArray/max-string-length:64/batch-size:1024 9806 ns 9727 ns 72805 bytes_per_second=100.4M/s
BM_DictDecodingByteArray/max-string-length:512/batch-size:1024 42235 ns 40494 ns 18053 bytes_per_second=192.928M/s
BM_DictDecodingByteArray/max-string-length:1024/batch-size:1024 66970 ns 66854 ns 10314 bytes_per_second=233.718M/s
```
Runing on x86 may got a bit differents, because it can make full use of simd unpack, which could make Dict Decoding a bit faster
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] pitrou commented on a diff in pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on code in PR #34323:
URL: https://github.com/apache/arrow/pull/34323#discussion_r1120116203
##########
cpp/src/parquet/encoding_benchmark.cc:
##########
@@ -569,6 +569,133 @@ BENCHMARK(BM_DeltaBitPackingDecode_Int64_Narrow)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int32_Wide)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int64_Wide)->Range(MIN_RANGE, MAX_RANGE);
+static void ByteArrayCustomArguments(benchmark::internal::Benchmark* b) {
+ b->ArgsProduct({{8, 64, 1024}, {512, 2048}})
+ ->ArgNames({"max-string-length", "batch-size"});
+}
+
+void EncodingByteArrayBenchmark(benchmark::State& state, Encoding::type encoding) {
+ ::arrow::random::RandomArrayGenerator rag(0);
+ // Using arrow generator to generate random data.
+ int32_t max_length = static_cast<int32_t>(state.range(0));
+ int32_t array_size = static_cast<int32_t>(state.range(1));
+ auto array =
+ rag.String(/* size */ array_size, /* min_length */ 0, /* max_length */ max_length,
+ /* null_probability */ 0);
+ const auto array_actual =
+ ::arrow::internal::checked_pointer_cast<::arrow::StringArray>(array);
+ auto encoder = MakeTypedEncoder<ByteArrayType>(encoding);
+ std::vector<ByteArray> values;
+ for (int i = 0; i < array_actual->length(); ++i) {
+ values.emplace_back(array_actual->GetView(i));
+ }
+
+ for (auto _ : state) {
+ encoder->Put(values.data(), static_cast<int>(values.size()));
+ encoder->FlushValues();
+ }
+ state.SetItemsProcessed(state.iterations() * array_actual->length());
+ state.counters["byte_array_bytes"] =
+ static_cast<double>(state.iterations() * array_actual->total_values_length());
Review Comment:
I think something like this would be more informative
```suggestion
state.SetBytesProcessed(state.iterations() * array_actual->total_values_length());
```
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] mapleFU commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1448382011
I guess that's expected, after applying https://github.com/apache/arrow/pull/34336 . They runs much more faster.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] mapleFU commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1445609371
@pitrou @rok Mind take a look?
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] github-actions[bot] commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1442768774
:warning: GitHub issue #34322 **has been automatically assigned in GitHub** to PR creator.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] mapleFU commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1443287551
Spaced encoding would be added, by the way, I wonder if it's valuable to add benchmark for string with different lengths. = =
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] mapleFU commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1448378640
Are you running in debug mode? Ryzen 3900X should be faster than my macos release...
```
BM_PlainEncodingByteArray/max-string-length:1024/batch-size:2048 224545 ns 221335 ns 3151 bytes_per_second=4.47808G/s items_per_second=9.25294M/s
BM_DeltaLengthEncodingByteArray/max-string-length:8/batch-size:512 6823 ns 6815 ns 101843 bytes_per_second=284.071M/s items_per_second=75.1277M/s
BM_DeltaLengthEncodingByteArray/max-string-length:64/batch-size:512 8291 ns 8247 ns 85111 bytes_per_second=1.86698G/s items_per_second=62.081M/s
BM_DeltaLengthEncodingByteArray/max-string-length:1024/batch-size:512 65729 ns 65337 ns 10725 bytes_per_second=3.84732G/s items_per_second=7.83635M/s
BM_DeltaLengthEncodingByteArray/max-string-length:8/batch-size:2048 26635 ns 26620 ns 26560 bytes_per_second=293.81M/s items_per_second=76.9361M/s
BM_DeltaLengthEncodingByteArray/max-string-length:64/batch-size:2048 54225 ns 53853 ns 12832 bytes_per_second=1.11712G/s items_per_second=38.0292M/s
BM_DeltaLengthEncodingByteArray/max-string-length:1024/batch-size:2048 246359 ns 245578 ns 2818 bytes_per_second=4.03602G/s items_per_second=8.33951M/s
```
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] pitrou commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1448373912
I get the figures below. Is it expected?
```
BM_DeltaLengthDecodingByteArray/max-string-length:8/batch-size:512 41664 ns 41656 ns 16802 bytes_per_second=46.7035M/s items_per_second=12.2911M/s
BM_DeltaLengthDecodingByteArray/max-string-length:64/batch-size:512 240049 ns 239998 ns 2917 bytes_per_second=65.2239M/s items_per_second=2.13335M/s
BM_DeltaLengthDecodingByteArray/max-string-length:1024/batch-size:512 3630825 ns 3630178 ns 193 bytes_per_second=68.947M/s items_per_second=141.04k/s
BM_DeltaLengthDecodingByteArray/max-string-length:8/batch-size:2048 151227 ns 151203 ns 4778 bytes_per_second=51.36M/s items_per_second=13.5447M/s
BM_DeltaLengthDecodingByteArray/max-string-length:64/batch-size:2048 935939 ns 935761 ns 744 bytes_per_second=66.5704M/s items_per_second=2.18859M/s
BM_DeltaLengthDecodingByteArray/max-string-length:1024/batch-size:2048 14463162 ns 14461140 ns 48 bytes_per_second=68.9333M/s items_per_second=141.621k/s
```
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] wgtmac commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "wgtmac (via GitHub)" <gi...@apache.org>.
wgtmac commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1448474977
IMHO, `DeltaBitPackEncoder` has two possible optimizations.
1. The mini-block size is fixed. This can be chosen adaptively based on data distribution. It can in turn affect the decoding time: https://github.com/apache/arrow/blob/main/cpp/src/parquet/encoding.cc#L2105
```cpp
static constexpr uint32_t kValuesPerBlock = 128;
static constexpr uint32_t kMiniBlocksPerBlock = 4;
```
2. It involves a procedure to compute deltas in the encoder and restore the values in the decoder. It can be vectorized to accelerate the encoding/decoding time.
https://github.com/apache/arrow/blob/main/cpp/src/parquet/encoding.cc#L2526
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] mapleFU commented on a diff in pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on code in PR #34323:
URL: https://github.com/apache/arrow/pull/34323#discussion_r1120185716
##########
cpp/src/parquet/encoding_benchmark.cc:
##########
@@ -569,6 +569,133 @@ BENCHMARK(BM_DeltaBitPackingDecode_Int64_Narrow)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int32_Wide)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int64_Wide)->Range(MIN_RANGE, MAX_RANGE);
+static void ByteArrayCustomArguments(benchmark::internal::Benchmark* b) {
+ b->ArgsProduct({{8, 64, 1024}, {512, 2048}})
+ ->ArgNames({"max-string-length", "batch-size"});
+}
+
+void EncodingByteArrayBenchmark(benchmark::State& state, Encoding::type encoding) {
+ ::arrow::random::RandomArrayGenerator rag(0);
+ // Using arrow generator to generate random data.
+ int32_t max_length = static_cast<int32_t>(state.range(0));
+ int32_t array_size = static_cast<int32_t>(state.range(1));
+ auto array =
+ rag.String(/* size */ array_size, /* min_length */ 0, /* max_length */ max_length,
+ /* null_probability */ 0);
+ const auto array_actual =
+ ::arrow::internal::checked_pointer_cast<::arrow::StringArray>(array);
+ auto encoder = MakeTypedEncoder<ByteArrayType>(encoding);
+ std::vector<ByteArray> values;
+ for (int i = 0; i < array_actual->length(); ++i) {
+ values.emplace_back(array_actual->GetView(i));
+ }
+
+ for (auto _ : state) {
+ encoder->Put(values.data(), static_cast<int>(values.size()));
+ encoder->FlushValues();
+ }
+ state.SetItemsProcessed(state.iterations() * array_actual->length());
+ state.counters["byte_array_bytes"] =
+ static_cast<double>(state.iterations() * array_actual->total_values_length());
Review Comment:
Okay. Previously I didn't use `BytesProcessed` because the syntax is a bit trickey here. String is va-length + `sizeof(ByteArray)`, which differs from u32 or other POD types.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] pitrou commented on a diff in pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on code in PR #34323:
URL: https://github.com/apache/arrow/pull/34323#discussion_r1120189475
##########
cpp/src/parquet/encoding_benchmark.cc:
##########
@@ -569,6 +569,133 @@ BENCHMARK(BM_DeltaBitPackingDecode_Int64_Narrow)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int32_Wide)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int64_Wide)->Range(MIN_RANGE, MAX_RANGE);
+static void ByteArrayCustomArguments(benchmark::internal::Benchmark* b) {
+ b->ArgsProduct({{8, 64, 1024}, {512, 2048}})
+ ->ArgNames({"max-string-length", "batch-size"});
+}
+
+void EncodingByteArrayBenchmark(benchmark::State& state, Encoding::type encoding) {
+ ::arrow::random::RandomArrayGenerator rag(0);
+ // Using arrow generator to generate random data.
+ int32_t max_length = static_cast<int32_t>(state.range(0));
+ int32_t array_size = static_cast<int32_t>(state.range(1));
+ auto array =
+ rag.String(/* size */ array_size, /* min_length */ 0, /* max_length */ max_length,
+ /* null_probability */ 0);
+ const auto array_actual =
+ ::arrow::internal::checked_pointer_cast<::arrow::StringArray>(array);
+ auto encoder = MakeTypedEncoder<ByteArrayType>(encoding);
+ std::vector<ByteArray> values;
+ for (int i = 0; i < array_actual->length(); ++i) {
+ values.emplace_back(array_actual->GetView(i));
+ }
+
+ for (auto _ : state) {
+ encoder->Put(values.data(), static_cast<int>(values.size()));
+ encoder->FlushValues();
+ }
+ state.SetItemsProcessed(state.iterations() * array_actual->length());
+ state.counters["byte_array_bytes"] =
+ static_cast<double>(state.iterations() * array_actual->total_values_length());
Review Comment:
I agree the figure is a bit approximative. But it's a good indicator nonetheless.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] mapleFU commented on a diff in pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on code in PR #34323:
URL: https://github.com/apache/arrow/pull/34323#discussion_r1118306858
##########
cpp/src/parquet/encoding_benchmark.cc:
##########
@@ -569,6 +569,126 @@ BENCHMARK(BM_DeltaBitPackingDecode_Int64_Narrow)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int32_Wide)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int64_Wide)->Range(MIN_RANGE, MAX_RANGE);
+void EncodingByteArrayBenchmark(benchmark::State& state, Encoding::type encoding) {
+ ::arrow::random::RandomArrayGenerator rag(0);
+ // Using arrow generator to generate random data.
+ int32_t max_length = state.range(0);
+ auto array =
+ rag.String(/* size */ 1024, /* min_length */ 0, /* max_length */ max_length,
+ /* null_probability */ 0);
+ const auto array_actual =
+ ::arrow::internal::checked_pointer_cast<::arrow::StringArray>(array);
+ auto encoder = MakeTypedEncoder<ByteArrayType>(encoding);
+ std::vector<ByteArray> values;
+ for (int i = 0; i < array_actual->length(); ++i) {
+ values.emplace_back(array_actual->GetView(i));
+ }
+
+ for (auto _ : state) {
+ encoder->Put(values.data(), static_cast<int>(values.size()));
+ encoder->FlushValues();
+ }
+ state.SetItemsProcessed(state.iterations() * array_actual->length());
+ state.counters["byte_array_bytes"] =
+ state.iterations() * array_actual->total_values_length();
+}
+
+static void BM_DeltaBitLengthEncodingByteArray(benchmark::State& state) {
+ EncodingByteArrayBenchmark(state, Encoding::DELTA_LENGTH_BYTE_ARRAY);
+}
+
+static void BM_PlainEncodingByteArray(benchmark::State& state) {
+ EncodingByteArrayBenchmark(state, Encoding::PLAIN);
Review Comment:
Sure, but dictionary encoder is listed later. Let me take a look
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] mapleFU commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1443344621
Okay, I'd like to add spaced test, and submit a report on different machines tonight.
By the way, I'd like to test that https://github.com/apache/arrow/pull/14293#discussion_r1070291837 would boost encoder performance.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] mapleFU commented on pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on PR #34323:
URL: https://github.com/apache/arrow/pull/34323#issuecomment-1444016861
On my MacOs, Release ( O2) enabled, with default memory allocator:
```
---------------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations UserCounters...
---------------------------------------------------------------------------------------------------
BM_PlainEncodingByteArray 113427 ns 111588 ns 6496 byte_array_bytes=3.43905G items_per_second=9.17665M/s
BM_DeltaBitLengthEncodingByteArray 131604 ns 127634 ns 5368 byte_array_bytes=2.84188G items_per_second=8.02297M/s
BM_PlainDecodingByteArray 3581 ns 3499 ns 193420 byte_array_bytes=102.399G items_per_second=292.683M/s
BM_DeltaBitLengthDecodingByteArray 183808 ns 180761 ns 3913 byte_array_bytes=2.07159G items_per_second=5.66495M/s
BM_PlainDecodingSpacedByteArray 3519 ns 3513 ns 191379 byte_array_bytes=99.4606G items_per_second=291.501M/s null_percent=2
BM_DeltaBitLengthDecodingSpacedByteArray 131179 ns 130943 ns 5341 byte_array_bytes=2.77574G items_per_second=7.8202M/s null_percent=2
```
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] mapleFU commented on a diff in pull request #34323: GH-34322: [C++][Parquet] Encoding Microbench for ByteArray
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on code in PR #34323:
URL: https://github.com/apache/arrow/pull/34323#discussion_r1128335912
##########
cpp/src/parquet/encoding_benchmark.cc:
##########
@@ -569,6 +569,130 @@ BENCHMARK(BM_DeltaBitPackingDecode_Int64_Narrow)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int32_Wide)->Range(MIN_RANGE, MAX_RANGE);
BENCHMARK(BM_DeltaBitPackingDecode_Int64_Wide)->Range(MIN_RANGE, MAX_RANGE);
+static void ByteArrayCustomArguments(benchmark::internal::Benchmark* b) {
+ b->ArgsProduct({{8, 64, 1024}, {512, 2048}})
+ ->ArgNames({"max-string-length", "batch-size"});
+}
+
+void EncodingByteArrayBenchmark(benchmark::State& state, Encoding::type encoding) {
+ ::arrow::random::RandomArrayGenerator rag(0);
+ // Using arrow generator to generate random data.
+ int32_t max_length = static_cast<int32_t>(state.range(0));
+ int32_t array_size = static_cast<int32_t>(state.range(1));
+ auto array =
+ rag.String(/* size */ array_size, /* min_length */ 0, /* max_length */ max_length,
+ /* null_probability */ 0);
+ const auto array_actual =
+ ::arrow::internal::checked_pointer_cast<::arrow::StringArray>(array);
+ auto encoder = MakeTypedEncoder<ByteArrayType>(encoding);
+ std::vector<ByteArray> values;
+ for (int i = 0; i < array_actual->length(); ++i) {
+ values.emplace_back(array_actual->GetView(i));
+ }
+
+ for (auto _ : state) {
+ encoder->Put(values.data(), static_cast<int>(values.size()));
+ encoder->FlushValues();
+ }
+ state.SetItemsProcessed(state.iterations() * array_actual->length());
+ state.SetBytesProcessed(state.iterations() * array_actual->total_values_length());
+}
+
+static void BM_DeltaLengthEncodingByteArray(benchmark::State& state) {
+ EncodingByteArrayBenchmark(state, Encoding::DELTA_LENGTH_BYTE_ARRAY);
+}
+
+static void BM_PlainEncodingByteArray(benchmark::State& state) {
+ EncodingByteArrayBenchmark(state, Encoding::PLAIN);
+}
+
+void DecodingByteArrayBenchmark(benchmark::State& state, Encoding::type encoding) {
+ ::arrow::random::RandomArrayGenerator rag(0);
+ int32_t max_length = static_cast<int32_t>(state.range(0));
+ int32_t array_size = static_cast<int32_t>(state.range(1));
+ // Using arrow to write, because we just benchmark decoding here.
+ auto array =
+ rag.String(/* size */ array_size, /* min_length */ 0, /* max_length */ max_length,
+ /* null_probability */ 0);
+ const auto array_actual =
+ ::arrow::internal::checked_pointer_cast<::arrow::StringArray>(array);
+ auto encoder = MakeTypedEncoder<ByteArrayType>(encoding);
+ encoder->Put(*array);
+ std::shared_ptr<Buffer> buf = encoder->FlushValues();
+
+ std::vector<ByteArray> values;
+ values.resize(array->length());
+ for (auto _ : state) {
+ auto decoder = MakeTypedDecoder<ByteArrayType>(encoding);
+ decoder->SetData(static_cast<int>(array->length()), buf->data(),
+ static_cast<int>(buf->size()));
+ decoder->Decode(values.data(), static_cast<int>(values.size()));
+ ::benchmark::DoNotOptimize(values);
+ }
+ state.SetItemsProcessed(state.iterations() * array->length());
Review Comment:
`array` is an `::arrow::Array`, and `array_actual` is underlying typed array, there length are equal, so I think it's not neccessary to change it
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org