Repository navigation
GH-41035: [C++] Add a grouper benchmark for preventing performance regression - #41036
Conversation
|
|
|
@ursabot please benchmark |
|
Benchmark runs are scheduled for commit 620fc87373a76e1805167cb2ed81bb482f10eb1a. Watch https://buildkite.com/apache-arrow and https://conbench.ursa.dev for updates. A comment will be posted here when the runs are complete. |
|
@pitrou @westonpace PTAL? |
620fc87 to
dc0a5b7
Compare
|
Thanks for your patience. Conbench analyzed the 7 benchmarking runs that have been run so far on PR commit 620fc87373a76e1805167cb2ed81bb482f10eb1a. There was 1 benchmark result with an error:
There were 4 benchmark results indicating a performance regression:
The full Conbench report has more details. |
dc0a5b7 to
001d4c3
Compare
|
@ursabot please benchmark |
|
Benchmark runs are scheduled for commit 001d4c30a2d7d886fa5b452803e8be84efb3f82e. Watch https://buildkite.com/apache-arrow and https://conbench.ursa.dev for updates. A comment will be posted here when the runs are complete. |
|
Thanks for your patience. Conbench analyzed the 4 benchmarking runs that have been run so far on PR commit 001d4c30a2d7d886fa5b452803e8be84efb3f82e. There were no benchmark performance regressions. 🎉 The full Conbench report has more details. |
westonpace
left a comment
There was a problem hiding this comment.
Very cool benchmark, nice and concisely written yet covers a wide variety of cases.
One minor nit is that I prefer bytes processed over items processed (it is more comparable and I don't have to worry about knowing as many details of the benchmark) but I won't force that.
Can you share some example results? I see conbench runs but can't find this benchmark in the report (perhaps my mistake on reading the report)
There was a problem hiding this comment.
Is the Grouper stateless? Would it make more sense to do this in batches?
for (auto _ : state) {
// Create new grouper
grouper = ...
// 256 is just some arbitrary batch size to make sure initialization of the grouper doesn't dominate the benchmark
for (int i = 0; i < 256; i++) {
ASSIGN_OR_ABORT(auto group_ids, grouper->Consume(span));
}
}
Or would it maybe make sense to do one run first to prime the result:
// Prime the grouper
ASSIGN_OR_ABORT(auto init, grouper->Consume(span));
for (auto _ : state) {
...
This is only a minor nit, feel free to ignore. In the grand scheme of things, if we are getting enough iterations, this probably doesn't really matter.
There was a problem hiding this comment.
Agree with this!
|
I would really prefer items/s over bytes/s as bytes/s is highly misleading. In the end, we are most of the time interested in performance over logical items, not in how large the data representation is. |
|
(that said, it's not forbidden to add both) |
As pitrou said, bytes is actually not accurate in this benchmark because we have a varlength type, which may make the bytes/s indicator very high, but it is not as intuitive as items/s. The results are like below: 2024-04-11T09:04:45+08:00
Running ./arrow-compute-grouper-benchmark
Run on (16 X 3800 MHz CPU s)
CPU Caches:
L1 Data 32 KiB (x8)
L1 Instruction 32 KiB (x8)
L2 Unified 512 KiB (x8)
L3 Unified 16384 KiB (x1)
Load Average: 1.18, 1.64, 1.97
***WARNING*** CPU scaling is enabled, the benchmark real time measurements may be noisy and will incur extra overhead.
***WARNING*** Library was built as DEBUG. Timings may be affected.
---------------------------------------------------------------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations UserCounters...
---------------------------------------------------------------------------------------------------------------------------------------------------
GrouperWithMultiTypes/"{boolean}"/1024/10000 1329 us 1329 us 526 items_per_second=770.333k/s null_percent=0.01 size=1.024k
GrouperWithMultiTypes/"{boolean}"/1024/100 1508 us 1507 us 465 items_per_second=679.37k/s null_percent=1 size=1.024k
GrouperWithMultiTypes/"{boolean}"/1024/10 1534 us 1533 us 457 items_per_second=667.84k/s null_percent=10 size=1.024k
GrouperWithMultiTypes/"{boolean}"/1024/2 1616 us 1616 us 432 items_per_second=633.552k/s null_percent=50 size=1.024k
GrouperWithMultiTypes/"{boolean}"/1024/1 1720 us 1720 us 405 items_per_second=595.489k/s null_percent=100 size=1.024k
GrouperWithMultiTypes/"{boolean}"/1024/0 1333 us 1333 us 527 items_per_second=768.172k/s null_percent=0 size=1.024k
GrouperWithMultiTypes/"{boolean}"/4096/10000 5127 us 5127 us 137 items_per_second=798.951k/s null_percent=0.01 size=4.096k
GrouperWithMultiTypes/"{boolean}"/4096/100 5819 us 5818 us 120 items_per_second=703.99k/s null_percent=1 size=4.096k
GrouperWithMultiTypes/"{boolean}"/4096/10 5877 us 5876 us 118 items_per_second=697.06k/s null_percent=10 size=4.096k
GrouperWithMultiTypes/"{boolean}"/4096/2 6308 us 6307 us 112 items_per_second=649.449k/s null_percent=50 size=4.096k
GrouperWithMultiTypes/"{boolean}"/4096/1 6641 us 6640 us 105 items_per_second=616.851k/s null_percent=100 size=4.096k
GrouperWithMultiTypes/"{boolean}"/4096/0 5121 us 5120 us 136 items_per_second=800.072k/s null_percent=0 size=4.096k
GrouperWithMultiTypes/"{int32}"/1024/10000 1368 us 1368 us 513 items_per_second=748.798k/s null_percent=0.01 size=1.024k
GrouperWithMultiTypes/"{int32}"/1024/100 1620 us 1620 us 432 items_per_second=632.098k/s null_percent=1 size=1.024k
GrouperWithMultiTypes/"{int32}"/1024/10 1597 us 1597 us 439 items_per_second=641.304k/s null_percent=10 size=1.024k
GrouperWithMultiTypes/"{int32}"/1024/2 1625 us 1624 us 431 items_per_second=630.423k/s null_percent=50 size=1.024k
GrouperWithMultiTypes/"{int32}"/1024/1 1637 us 1636 us 428 items_per_second=625.837k/s null_percent=100 size=1.024k
GrouperWithMultiTypes/"{int32}"/1024/0 1379 us 1378 us 508 items_per_second=743.075k/s null_percent=0 size=1.024k
GrouperWithMultiTypes/"{int32}"/4096/10000 5402 us 5401 us 130 items_per_second=758.434k/s null_percent=0.01 size=4.096k
GrouperWithMultiTypes/"{int32}"/4096/100 6196 us 6195 us 113 items_per_second=661.201k/s null_percent=1 size=4.096k
GrouperWithMultiTypes/"{int32}"/4096/10 6165 us 6164 us 113 items_per_second=664.549k/s null_percent=10 size=4.096k
GrouperWithMultiTypes/"{int32}"/4096/2 6300 us 6299 us 111 items_per_second=650.222k/s null_percent=50 size=4.096k
GrouperWithMultiTypes/"{int32}"/4096/1 6287 us 6286 us 111 items_per_second=651.6k/s null_percent=100 size=4.096k
GrouperWithMultiTypes/"{int32}"/4096/0 5412 us 5411 us 129 items_per_second=757.029k/s null_percent=0 size=4.096k
GrouperWithMultiTypes/"{int64}"/1024/10000 1347 us 1347 us 518 items_per_second=760.192k/s null_percent=0.01 size=1.024k
GrouperWithMultiTypes/"{int64}"/1024/100 1569 us 1568 us 447 items_per_second=652.955k/s null_percent=1 size=1.024k
GrouperWithMultiTypes/"{int64}"/1024/10 1577 us 1576 us 444 items_per_second=649.554k/s null_percent=10 size=1.024k
GrouperWithMultiTypes/"{int64}"/1024/2 1604 us 1604 us 435 items_per_second=638.412k/s null_percent=50 size=1.024k
GrouperWithMultiTypes/"{int64}"/1024/1 1607 us 1607 us 435 items_per_second=637.123k/s null_percent=100 size=1.024k
GrouperWithMultiTypes/"{int64}"/1024/0 1374 us 1374 us 522 items_per_second=745.246k/s null_percent=0 size=1.024k
GrouperWithMultiTypes/"{int64}"/4096/10000 5371 us 5370 us 129 items_per_second=762.703k/s null_percent=0.01 size=4.096k
GrouperWithMultiTypes/"{int64}"/4096/100 6181 us 6180 us 113 items_per_second=662.826k/s null_percent=1 size=4.096k
GrouperWithMultiTypes/"{int64}"/4096/10 6157 us 6156 us 113 items_per_second=665.384k/s null_percent=10 size=4.096k
GrouperWithMultiTypes/"{int64}"/4096/2 6234 us 6232 us 112 items_per_second=657.237k/s null_percent=50 size=4.096k
GrouperWithMultiTypes/"{int64}"/4096/1 6251 us 6250 us 113 items_per_second=655.382k/s null_percent=100 size=4.096k
GrouperWithMultiTypes/"{int64}"/4096/0 5371 us 5370 us 130 items_per_second=762.709k/s null_percent=0 size=4.096k
GrouperWithMultiTypes/"{utf8}"/1024/10000 2497 us 2496 us 281 items_per_second=410.19k/s null_percent=0.01 size=1.024k
GrouperWithMultiTypes/"{utf8}"/1024/100 2694 us 2694 us 260 items_per_second=380.111k/s null_percent=1 size=1.024k
GrouperWithMultiTypes/"{utf8}"/1024/10 2617 us 2616 us 268 items_per_second=391.371k/s null_percent=10 size=1.024k
GrouperWithMultiTypes/"{utf8}"/1024/2 2551 us 2551 us 274 items_per_second=401.434k/s null_percent=50 size=1.024k
GrouperWithMultiTypes/"{utf8}"/1024/1 3188 us 3187 us 220 items_per_second=321.258k/s null_percent=100 size=1.024k
GrouperWithMultiTypes/"{utf8}"/1024/0 2501 us 2500 us 273 items_per_second=409.55k/s null_percent=0 size=1.024k
GrouperWithMultiTypes/"{utf8}"/4096/10000 10590 us 10588 us 66 items_per_second=386.85k/s null_percent=0.01 size=4.096k
GrouperWithMultiTypes/"{utf8}"/4096/100 10617 us 10615 us 66 items_per_second=385.858k/s null_percent=1 size=4.096k
GrouperWithMultiTypes/"{utf8}"/4096/10 10379 us 10377 us 67 items_per_second=394.717k/s null_percent=10 size=4.096k
GrouperWithMultiTypes/"{utf8}"/4096/2 10074 us 10072 us 70 items_per_second=406.684k/s null_percent=50 size=4.096k
GrouperWithMultiTypes/"{utf8}"/4096/1 12487 us 12485 us 56 items_per_second=328.078k/s null_percent=100 size=4.096k
GrouperWithMultiTypes/"{utf8}"/4096/0 9820 us 9817 us 71 items_per_second=417.214k/s null_percent=0 size=4.096k
GrouperWithMultiTypes/"{fixed_size_binary(128)}"/1024/10000 3061 us 3060 us 228 items_per_second=334.659k/s null_percent=0.01 size=1.024k
GrouperWithMultiTypes/"{fixed_size_binary(128)}"/1024/100 3316 us 3315 us 209 items_per_second=308.917k/s null_percent=1 size=1.024k
GrouperWithMultiTypes/"{fixed_size_binary(128)}"/1024/10 3340 us 3339 us 211 items_per_second=306.641k/s null_percent=10 size=1.024k
GrouperWithMultiTypes/"{fixed_size_binary(128)}"/1024/2 3242 us 3241 us 217 items_per_second=315.953k/s null_percent=50 size=1.024k
GrouperWithMultiTypes/"{fixed_size_binary(128)}"/1024/1 3157 us 3156 us 221 items_per_second=324.446k/s null_percent=100 size=1.024k
GrouperWithMultiTypes/"{fixed_size_binary(128)}"/1024/0 3114 us 3114 us 226 items_per_second=328.872k/s null_percent=0 size=1.024k
GrouperWithMultiTypes/"{fixed_size_binary(128)}"/4096/10000 12839 us 12836 us 55 items_per_second=319.102k/s null_percent=0.01 size=4.096k
GrouperWithMultiTypes/"{fixed_size_binary(128)}"/4096/100 13759 us 13755 us 51 items_per_second=297.774k/s null_percent=1 size=4.096k
GrouperWithMultiTypes/"{fixed_size_binary(128)}"/4096/10 13416 us 13413 us 53 items_per_second=305.371k/s null_percent=10 size=4.096k
GrouperWithMultiTypes/"{fixed_size_binary(128)}"/4096/2 13103 us 13101 us 54 items_per_second=312.646k/s null_percent=50 size=4.096k
GrouperWithMultiTypes/"{fixed_size_binary(128)}"/4096/1 12628 us 12626 us 55 items_per_second=324.398k/s null_percent=100 size=4.096k
GrouperWithMultiTypes/"{fixed_size_binary(128)}"/4096/0 12778 us 12775 us 55 items_per_second=320.619k/s null_percent=0 size=4.096k
GrouperWithMultiTypes/"{boolean, utf8}"/1024/10000 3102 us 3102 us 226 items_per_second=330.162k/s null_percent=0.01 size=1.024k
GrouperWithMultiTypes/"{boolean, utf8}"/1024/100 13830 us 13827 us 51 items_per_second=74.0558k/s null_percent=1 size=1.024k
GrouperWithMultiTypes/"{boolean, utf8}"/1024/10 394675 us 394582 us 2 items_per_second=2.59515k/s null_percent=10 size=1.024k
GrouperWithMultiTypes/"{boolean, utf8}"/1024/2 1409485 us 1409178 us 1 items_per_second=726.665/s null_percent=50 size=1.024k
GrouperWithMultiTypes/"{boolean, utf8}"/1024/1 4343 us 4343 us 162 items_per_second=235.808k/s null_percent=100 size=1.024k
GrouperWithMultiTypes/"{boolean, utf8}"/1024/0 3111 us 3111 us 226 items_per_second=329.148k/s null_percent=0 size=1.024k
GrouperWithMultiTypes/"{boolean, utf8}"/4096/10000 13898 us 13894 us 51 items_per_second=294.793k/s null_percent=0.01 size=4.096k
GrouperWithMultiTypes/"{boolean, utf8}"/4096/100 54716 us 54700 us 12 items_per_second=74.8806k/s null_percent=1 size=4.096k
GrouperWithMultiTypes/"{boolean, utf8}"/4096/10 941758 us 941554 us 1 items_per_second=4.35026k/s null_percent=10 size=4.096k
GrouperWithMultiTypes/"{boolean, utf8}"/4096/2 12871536 us 12868926 us 1 items_per_second=318.286/s null_percent=50 size=4.096k
GrouperWithMultiTypes/"{boolean, utf8}"/4096/1 16971 us 16968 us 41 items_per_second=241.392k/s null_percent=100 size=4.096k
GrouperWithMultiTypes/"{boolean, utf8}"/4096/0 12383 us 12381 us 56 items_per_second=330.834k/s null_percent=0 size=4.096k
GrouperWithMultiTypes/"{int32, int32}"/1024/10000 1635 us 1634 us 428 items_per_second=626.497k/s null_percent=0.01 size=1.024k
GrouperWithMultiTypes/"{int32, int32}"/1024/100 2020 us 2019 us 344 items_per_second=507.07k/s null_percent=1 size=1.024k
GrouperWithMultiTypes/"{int32, int32}"/1024/10 2114 us 2114 us 331 items_per_second=484.407k/s null_percent=10 size=1.024k
GrouperWithMultiTypes/"{int32, int32}"/1024/2 2318 us 2317 us 303 items_per_second=441.867k/s null_percent=50 size=1.024k
GrouperWithMultiTypes/"{int32, int32}"/1024/1 2499 us 2498 us 280 items_per_second=409.852k/s null_percent=100 size=1.024k
GrouperWithMultiTypes/"{int32, int32}"/1024/0 1636 us 1636 us 420 items_per_second=625.86k/s null_percent=0 size=1.024k
GrouperWithMultiTypes/"{int32, int32}"/4096/10000 6523 us 6522 us 108 items_per_second=628.047k/s null_percent=0.01 size=4.096k
GrouperWithMultiTypes/"{int32, int32}"/4096/100 8122 us 8120 us 86 items_per_second=504.427k/s null_percent=1 size=4.096k
GrouperWithMultiTypes/"{int32, int32}"/4096/10 8473 us 8472 us 83 items_per_second=483.476k/s null_percent=10 size=4.096k
GrouperWithMultiTypes/"{int32, int32}"/4096/2 9209 us 9207 us 76 items_per_second=444.856k/s null_percent=50 size=4.096k
GrouperWithMultiTypes/"{int32, int32}"/4096/1 9863 us 9861 us 70 items_per_second=415.358k/s null_percent=100 size=4.096k
GrouperWithMultiTypes/"{int32, int32}"/4096/0 6532 us 6531 us 107 items_per_second=627.155k/s null_percent=0 size=4.096k
GrouperWithMultiTypes/"{int32, int64}"/1024/10000 1628 us 1628 us 431 items_per_second=629.181k/s null_percent=0.01 size=1.024k
GrouperWithMultiTypes/"{int32, int64}"/1024/100 12616 us 12614 us 55 items_per_second=81.1817k/s null_percent=1 size=1.024k
GrouperWithMultiTypes/"{int32, int64}"/1024/10 89235 us 89216 us 8 items_per_second=11.4778k/s null_percent=10 size=1.024k
GrouperWithMultiTypes/"{int32, int64}"/1024/2 279436 us 279381 us 2 items_per_second=3.66524k/s null_percent=50 size=1.024k
GrouperWithMultiTypes/"{int32, int64}"/1024/1 2474 us 2473 us 283 items_per_second=413.992k/s null_percent=100 size=1.024k
GrouperWithMultiTypes/"{int32, int64}"/1024/0 1627 us 1627 us 429 items_per_second=629.503k/s null_percent=0 size=1.024k
GrouperWithMultiTypes/"{int32, int64}"/4096/10000 6484 us 6483 us 107 items_per_second=631.833k/s null_percent=0.01 size=4.096k
GrouperWithMultiTypes/"{int32, int64}"/4096/100 49194 us 49186 us 14 items_per_second=83.2752k/s null_percent=1 size=4.096k
GrouperWithMultiTypes/"{int32, int64}"/4096/10 414187 us 414110 us 2 items_per_second=9.89109k/s null_percent=10 size=4.096k
GrouperWithMultiTypes/"{int32, int64}"/4096/2 1350538 us 1350126 us 1 items_per_second=3.03379k/s null_percent=50 size=4.096k
GrouperWithMultiTypes/"{int32, int64}"/4096/1 9590 us 9588 us 73 items_per_second=427.195k/s null_percent=100 size=4.096k
GrouperWithMultiTypes/"{int32, int64}"/4096/0 6475 us 6474 us 108 items_per_second=632.68k/s null_percent=0 size=4.096k
GrouperWithMultiTypes/"{boolean, int64, utf8}"/1024/10000 3679 us 3678 us 190 items_per_second=278.42k/s null_percent=0.01 size=1.024k
GrouperWithMultiTypes/"{boolean, int64, utf8}"/1024/100 17617 us 17614 us 40 items_per_second=58.1361k/s null_percent=1 size=1.024k
GrouperWithMultiTypes/"{boolean, int64, utf8}"/1024/10 191058 us 191017 us 4 items_per_second=5.36077k/s null_percent=10 size=1.024k
GrouperWithMultiTypes/"{boolean, int64, utf8}"/1024/2 718916 us 718763 us 1 items_per_second=1.42467k/s null_percent=50 size=1.024k
GrouperWithMultiTypes/"{boolean, int64, utf8}"/1024/1 5451 us 5450 us 129 items_per_second=187.874k/s null_percent=100 size=1.024k
GrouperWithMultiTypes/"{boolean, int64, utf8}"/1024/0 3675 us 3675 us 190 items_per_second=278.664k/s null_percent=0 size=1.024k
GrouperWithMultiTypes/"{boolean, int64, utf8}"/4096/10000 17341 us 17338 us 41 items_per_second=236.242k/s null_percent=0.01 size=4.096k
GrouperWithMultiTypes/"{boolean, int64, utf8}"/4096/100 100409 us 100389 us 7 items_per_second=40.8013k/s null_percent=1 size=4.096k
GrouperWithMultiTypes/"{boolean, int64, utf8}"/4096/10 921094 us 920851 us 1 items_per_second=4.44806k/s null_percent=10 size=4.096k
GrouperWithMultiTypes/"{boolean, int64, utf8}"/4096/2 3632795 us 3631833 us 1 items_per_second=1.12781k/s null_percent=50 size=4.096k
GrouperWithMultiTypes/"{boolean, int64, utf8}"/4096/1 21414 us 21411 us 33 items_per_second=191.299k/s null_percent=100 size=4.096k
GrouperWithMultiTypes/"{boolean, int64, utf8}"/4096/0 14967 us 14965 us 46 items_per_second=273.711k/s null_percent=0 size=4.096k
GrouperWithMultiTypes/"{int32, boolean, utf8}"/1024/10000 3724 us 3724 us 188 items_per_second=275.008k/s null_percent=0.01 size=1.024k
GrouperWithMultiTypes/"{int32, boolean, utf8}"/1024/100 13209 us 13207 us 53 items_per_second=77.5372k/s null_percent=1 size=1.024k
GrouperWithMultiTypes/"{int32, boolean, utf8}"/1024/10 140985 us 140961 us 5 items_per_second=7.26443k/s null_percent=10 size=1.024k
GrouperWithMultiTypes/"{int32, boolean, utf8}"/1024/2 500871 us 500788 us 2 items_per_second=2.04478k/s null_percent=50 size=1.024k
GrouperWithMultiTypes/"{int32, boolean, utf8}"/1024/1 5491 us 5490 us 128 items_per_second=186.517k/s null_percent=100 size=1.024k
GrouperWithMultiTypes/"{int32, boolean, utf8}"/1024/0 3724 us 3723 us 188 items_per_second=275.053k/s null_percent=0 size=1.024k
GrouperWithMultiTypes/"{int32, boolean, utf8}"/4096/10000 17473 us 17469 us 40 items_per_second=234.471k/s null_percent=0.01 size=4.096k
GrouperWithMultiTypes/"{int32, boolean, utf8}"/4096/100 73179 us 73165 us 9 items_per_second=55.9829k/s null_percent=1 size=4.096k
GrouperWithMultiTypes/"{int32, boolean, utf8}"/4096/10 602449 us 602346 us 1 items_per_second=6.80008k/s null_percent=10 size=4.096k
GrouperWithMultiTypes/"{int32, boolean, utf8}"/4096/2 4447236 us 4446227 us 1 items_per_second=921.231/s null_percent=50 size=4.096k
GrouperWithMultiTypes/"{int32, boolean, utf8}"/4096/1 21541 us 21538 us 32 items_per_second=190.176k/s null_percent=100 size=4.096k
GrouperWithMultiTypes/"{int32, boolean, utf8}"/4096/0 15239 us 15236 us 46 items_per_second=268.834k/s null_percent=0 size=4.096k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/1024/10000 4207 us 4207 us 166 items_per_second=243.428k/s null_percent=0.01 size=1.024k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/1024/100 35682 us 35671 us 20 items_per_second=28.7065k/s null_percent=1 size=1.024k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/1024/10 280647 us 280589 us 2 items_per_second=3.64946k/s null_percent=10 size=1.024k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/1024/2 739914 us 739742 us 1 items_per_second=1.38427k/s null_percent=50 size=1.024k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/1024/1 6503 us 6502 us 107 items_per_second=157.495k/s null_percent=100 size=1.024k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/1024/0 4218 us 4218 us 166 items_per_second=242.792k/s null_percent=0 size=1.024k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/4096/10000 17237 us 17233 us 40 items_per_second=237.677k/s null_percent=0.01 size=4.096k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/4096/100 153723 us 153695 us 5 items_per_second=26.6501k/s null_percent=1 size=4.096k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/4096/10 1299692 us 1299383 us 1 items_per_second=3.15227k/s null_percent=10 size=4.096k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/4096/2 3874521 us 3873499 us 1 items_per_second=1.05744k/s null_percent=50 size=4.096k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/4096/1 25555 us 25551 us 27 items_per_second=160.306k/s null_percent=100 size=4.096k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/4096/0 17337 us 17332 us 41 items_per_second=236.323k/s null_percent=0 size=4.096k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/1024/10000 6799 us 6798 us 104 items_per_second=150.63k/s null_percent=0.01 size=1.024k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/1024/100 45711 us 45700 us 15 items_per_second=22.4068k/s null_percent=1 size=1.024k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/1024/10 445610 us 445504 us 2 items_per_second=2.29852k/s null_percent=10 size=1.024k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/1024/2 1191552 us 1191089 us 1 items_per_second=859.718/s null_percent=50 size=1.024k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/1024/1 9183 us 9182 us 75 items_per_second=111.529k/s null_percent=100 size=1.024k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/1024/0 6818 us 6816 us 104 items_per_second=150.231k/s null_percent=0 size=1.024k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/4096/10000 31751 us 31744 us 22 items_per_second=129.033k/s null_percent=0.01 size=4.096k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/4096/100 224880 us 224830 us 3 items_per_second=18.2182k/s null_percent=1 size=4.096k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/4096/10 2333998 us 2332975 us 1 items_per_second=1.7557k/s null_percent=10 size=4.096k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/4096/2 5439532 us 5437715 us 1 items_per_second=753.258/s null_percent=50 size=4.096k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/4096/1 36049 us 36043 us 19 items_per_second=113.64k/s null_percent=100 size=4.096k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/4096/0 27792 us 27785 us 25 items_per_second=147.415k/s null_percent=0 size=4.096k
|
001d4c3 to
ec199fa
Compare
pitrou
left a comment
There was a problem hiding this comment.
Thanks a lot @ZhangHuiGui . I wonder if these benchmarks are realistic, because it seems that in most cases (except boolean), the input keys will be mostly unique?
There was a problem hiding this comment.
Could you please move this into row/CMakeLists.txt?
There was a problem hiding this comment.
This is a third-party include, could you please move it above and use brackets (#include <benchmark/benchmark.h>)?
There was a problem hiding this comment.
We probably shouldn't make true_probability the same as null_probability (as it makes the data trivial if null_probability is either 0.0 or 1.0), how about a hardcoded value such as 0.2?
There was a problem hiding this comment.
Agree, 0.2 is enough for the current situation.
There was a problem hiding this comment.
That's gonna produce a lot of different groups if there's a string key, right? Is it realistic?
There was a problem hiding this comment.
This benchmark is mainly to ensure that the construction of our underlying RowTable and the performance of the comparison operations in the lower-level compare_internal can be tracked (we have not systematically tested these underlying operations before). It mainly covers some basics. Type, including the impact of null ratio on performance (comparison operations will compare null values separately.)
There was a problem hiding this comment.
Sure, but do we not want the workload to be more realistic?
There was a problem hiding this comment.
You are right, this is indeed a bit unrealistic. Can we use 0.1/0.2 to reduce the proportion of unique?
There was a problem hiding this comment.
Yes, that would be better IMHO.
You may also add a comment explaining why you want to test with a large-ish number of groups.
There was a problem hiding this comment.
You may also add a comment explaining why you want to test with a large-ish number of groups.
Agree
There was a problem hiding this comment.
Both scenarios have use cases. GroupBy/HashJoin are sometimes used for deduplication and in that use case the key is mostly unique (in fact, we hit bugs in our hash-join impl when users tried this case).
That being said, I agree the "few groups" case is much more common.
There was a problem hiding this comment.
In addition, it seems that we can also enable swiss_join with the are_cols_in_encoding_order=true option, which can improve the performance of comparison when hashkey-cols need to be resorted.
Of course, this requires some changes to SwissTableWithKeys::Input.
arrow/cpp/src/arrow/acero/swiss_join.cc
Lines 245 to 255 in 7288bd5
There was a problem hiding this comment.
Both scenarios have use cases. GroupBy/HashJoin are sometimes used for deduplication and in that use case the key is mostly unique (in fact, we hit bugs in our hash-join impl when users tried this case).
I see, thanks. Can we clearly mark both kinds of scenarios in the benchmarks? (either as comments in the source code or by using different names for the benchmarks)
There was a problem hiding this comment.
Added the comments on Unique's impact scenarios in the benchmark.
But I think there is no need to add an independent benchmark for this. If the data set is all unique and there are non-performance bugs, this matter should be handled by a UT?
This Benchmark should focus on the impact of combining different data types and column rearrangements that occur in RowTable on comparison performance?
There was a problem hiding this comment.
So, int32 and int64 keys will span the whole magnitude as well? Meaning they will be mostly unique?
There was a problem hiding this comment.
Yes, we hope that there are enough groups so that we can generate as many comparison operations as possible, which can verify that our underlying comparison performance is stable.
There was a problem hiding this comment.
Is 128 bytes a frequent size for fixed_size_binary? Intuitively, I would have guessed much shorter sizes are more common, e.g. 16, 20 or 32 (for decimals, uuids or sha160s, for example).
There was a problem hiding this comment.
Agree, 16 seems enough!
There was a problem hiding this comment.
What does "resorted" mean here? Do you mean the columns are in a different order?
There was a problem hiding this comment.
It's in RowTableMetadata::FromColumnMetadataVector when we construct a RowTable.
arrow/cpp/src/arrow/compute/row/row_internal.cc
Lines 87 to 88 in effd5af
There was a problem hiding this comment.
Wow, I had no idea the grouper could do this.
There was a problem hiding this comment.
FWIW: the ordering is defined here: https://github.com/apache/arrow/blob/main/cpp/src/arrow/compute/row/row_internal.cc#L65
I'll admit that I don't really understand how that makes things faster but it does, as shown in the comment that inspired this PR.
There was a problem hiding this comment.
Yes, we need to dig deeper into the root causes of performance improvement. :) It seems to be beyond expectations.
There was a problem hiding this comment.
Thanks to num_groups in the benchmark, I discovered a very interesting performance phenomenon. When setting are_cols_in_encoding_order in KeyCompare::CompareColumnsToRows in Grouper to false, using the same way of generating data sets we will Generate much more groups, and the performance with a larger number of groups will obviously be worse (because the grouper needs to build and find swisstable).
So the essence of the final performance problem is: Why does the number of groupings in the same data set increase significantly after resort column? Further analysis is needed.
# origin-order, produce much more groups than resorted order
GrouperWithMultiTypes/"{int32, int64}"/8388608/0 45000851 us 44976124 us 1 items_per_second=186.512k/s null_percent=0 num_groups=134.218M size=8.38861M uniqueness=1
GrouperWithMultiTypes/"{int32, int64}"/8388608/0 43829079 us 43799112 us 1 items_per_second=191.525k/s null_percent=0 num_groups=134.218M size=8.38861M uniqueness=1
# resorted order
GrouperWithMultiTypes/"{int64, int32}"/8388608/0 4955565 us 4952519 us 1 items_per_second=1.69381M/s null_percent=0 num_groups=8.38861M size=8.38861M uniqueness=0.0625
GrouperWithMultiTypes/"{int64, int32}"/8388608/0 5004994 us 5001648 us 1 items_per_second=1.67717M/s null_percent=0 num_groups=8.38861M size=8.38861M uniqueness=0.0625Besides, i've checked the compare logic of these two scenes, the internal logic of their compare is basically the same.
There was a problem hiding this comment.
It's bug in grouper when set are_cols_in_encoding_order=false in below codes:
arrow/cpp/src/arrow/compute/row/grouper.cc
Line 582 in 2979d69
It will cause the num_group different with are_cols_in_encoding_order=true condition.
The encoder will sort columns by default, when we only set this compare args to false, the CompareColumnsToRows's input impl_ptr->encoder_.batch_all_cols(), impl_ptr->rows_, are all sorted, but use the incorrect column_offset to access compared column:
arrow/cpp/src/arrow/compute/row/compare_internal.cc
Lines 366 to 369 in 2979d69
After simple fix the grouper's are_cols_in_encoding_order=false bug( by add are_cols_sorted into KeyColumnMetadata) i find that the performance almost same with are_cols_in_encoding_order=true.
And also, the purpose of the column-sort in RowTableEncoder is construct an aligned friendly condition for memory access. Resorted order will be used to produce an aligned column_offset for access the row data in encode/decode/compare.
There was a problem hiding this comment.
After i fix the bug of are_cols_in_encoding_order=false in grouper. Performance like below:
are_cols_in_encoding_order=false
GrouperWithMultiTypes/"{int32, boolean, utf8}"/1024/10000 288 us 288 us 2472 items_per_second=3.55257M/s null_percent=0.01 num_groups=1.024k size=1.024k
GrouperWithMultiTypes/"{int32, boolean, utf8}"/1024/100 332 us 331 us 2132 items_per_second=3.08928M/s null_percent=1 num_groups=1.024k size=1.024k
GrouperWithMultiTypes/"{int32, boolean, utf8}"/1024/10 329 us 329 us 2153 items_per_second=3.11651M/s null_percent=10 num_groups=1.009k size=1.024k
GrouperWithMultiTypes/"{int32, boolean, utf8}"/1024/2 324 us 324 us 2148 items_per_second=3.16498M/s null_percent=50 num_groups=730 size=1.024k
GrouperWithMultiTypes/"{int32, boolean, utf8}"/1024/1 359 us 359 us 1948 items_per_second=2.85145M/s null_percent=100 num_groups=1 size=1.024k
GrouperWithMultiTypes/"{int32, boolean, utf8}"/1024/0 286 us 286 us 2413 items_per_second=3.57668M/s null_percent=0 num_groups=1.024k size=1.024k
GrouperWithMultiTypes/"{int32, boolean, utf8}"/4096/10000 1282 us 1282 us 541 items_per_second=3.19499M/s null_percent=0.01 num_groups=4.096k size=4.096k
GrouperWithMultiTypes/"{int32, boolean, utf8}"/4096/100 1334 us 1334 us 522 items_per_second=3.07032M/s null_percent=1 num_groups=4.092k size=4.096k
GrouperWithMultiTypes/"{int32, boolean, utf8}"/4096/10 1330 us 1329 us 514 items_per_second=3.08117M/s null_percent=10 num_groups=3.999k size=4.096k
GrouperWithMultiTypes/"{int32, boolean, utf8}"/4096/2 1385 us 1385 us 502 items_per_second=2.95787M/s null_percent=50 num_groups=2.779k size=4.096k
GrouperWithMultiTypes/"{int32, boolean, utf8}"/4096/1 1400 us 1400 us 501 items_per_second=2.92583M/s null_percent=100 num_groups=1 size=4.096k
GrouperWithMultiTypes/"{int32, boolean, utf8}"/4096/0 1152 us 1152 us 601 items_per_second=3.55699M/s null_percent=0 num_groups=4.096k size=4.096k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/1024/10000 330 us 330 us 2081 items_per_second=3.10442M/s null_percent=0.01 num_groups=1.024k size=1.024k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/1024/100 395 us 395 us 1810 items_per_second=2.5926M/s null_percent=1 num_groups=1.024k size=1.024k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/1024/10 395 us 395 us 1771 items_per_second=2.59343M/s null_percent=10 num_groups=1.024k size=1.024k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/1024/2 394 us 394 us 1782 items_per_second=2.59703M/s null_percent=50 num_groups=887 size=1.024k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/1024/1 422 us 422 us 1657 items_per_second=2.42852M/s null_percent=100 num_groups=1 size=1.024k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/1024/0 320 us 320 us 2170 items_per_second=3.20108M/s null_percent=0 num_groups=1.024k size=1.024k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/4096/10000 1344 us 1344 us 516 items_per_second=3.04771M/s null_percent=0.01 num_groups=4.096k size=4.096k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/4096/100 1576 us 1576 us 446 items_per_second=2.59919M/s null_percent=1 num_groups=4.096k size=4.096k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/4096/10 1650 us 1650 us 431 items_per_second=2.48289M/s null_percent=10 num_groups=4.091k size=4.096k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/4096/2 1751 us 1751 us 418 items_per_second=2.33929M/s null_percent=50 num_groups=3.484k size=4.096k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/4096/1 1651 us 1651 us 424 items_per_second=2.48122M/s null_percent=100 num_groups=1 size=4.096k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/4096/0 1369 us 1369 us 523 items_per_second=2.99227M/s null_percent=0 num_groups=4.096k size=4.096k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/1024/10000 608 us 608 us 1149 items_per_second=1.68426M/s null_percent=0.01 num_groups=1.024k size=1.024k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/1024/100 688 us 688 us 1191 items_per_second=1.48927M/s null_percent=1 num_groups=1.024k size=1.024k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/1024/10 688 us 688 us 1005 items_per_second=1.48878M/s null_percent=10 num_groups=1.024k size=1.024k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/1024/2 738 us 738 us 969 items_per_second=1.38746M/s null_percent=50 num_groups=965 size=1.024k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/1024/1 568 us 568 us 1237 items_per_second=1.80246M/s null_percent=100 num_groups=1 size=1.024k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/1024/0 615 us 615 us 1198 items_per_second=1.66566M/s null_percent=0 num_groups=1.024k size=1.024k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/4096/10000 2838 us 2837 us 248 items_per_second=1.44393M/s null_percent=0.01 num_groups=4.096k size=4.096k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/4096/100 2942 us 2941 us 236 items_per_second=1.39289M/s null_percent=1 num_groups=4.096k size=4.096k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/4096/10 3018 us 3017 us 235 items_per_second=1.3578M/s null_percent=10 num_groups=4.096k size=4.096k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/4096/2 3151 us 3150 us 224 items_per_second=1.3002M/s null_percent=50 num_groups=3.828k size=4.096k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/4096/1 2271 us 2270 us 299 items_per_second=1.80433M/s null_percent=100 num_groups=1 size=4.096k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/4096/0 2663 us 2662 us 270 items_per_second=1.53886M/s null_percent=0 num_groups=4.096k size=4.096kare_cols_in_encoding_order=true
GrouperWithMultiTypes/"{int32, boolean, utf8}"/1024/10000 290 us 290 us 2469 items_per_second=3.52659M/s null_percent=0.01 num_groups=1.024k size=1.024k
GrouperWithMultiTypes/"{int32, boolean, utf8}"/1024/100 418 us 418 us 1702 items_per_second=2.44793M/s null_percent=1 num_groups=1.27k size=1.024k
GrouperWithMultiTypes/"{int32, boolean, utf8}"/1024/10 920 us 920 us 731 items_per_second=1.11333M/s null_percent=10 num_groups=3.598k size=1.024k
GrouperWithMultiTypes/"{int32, boolean, utf8}"/1024/2 4423 us 4422 us 158 items_per_second=231.569k/s null_percent=50 num_groups=6.386k size=1.024k
GrouperWithMultiTypes/"{int32, boolean, utf8}"/1024/1 367 us 367 us 1946 items_per_second=2.79268M/s null_percent=100 num_groups=1 size=1.024k
GrouperWithMultiTypes/"{int32, boolean, utf8}"/1024/0 279 us 279 us 2497 items_per_second=3.66686M/s null_percent=0 num_groups=1.024k size=1.024k
GrouperWithMultiTypes/"{int32, boolean, utf8}"/4096/10000 1233 us 1233 us 560 items_per_second=3.32317M/s null_percent=0.01 num_groups=4.098k size=4.096k
GrouperWithMultiTypes/"{int32, boolean, utf8}"/4096/100 1642 us 1642 us 415 items_per_second=2.49463M/s null_percent=1 num_groups=4.971k size=4.096k
GrouperWithMultiTypes/"{int32, boolean, utf8}"/4096/10 4417 us 4415 us 158 items_per_second=927.686k/s null_percent=10 num_groups=14.036k size=4.096k
GrouperWithMultiTypes/"{int32, boolean, utf8}"/4096/2 35053 us 35045 us 20 items_per_second=116.878k/s null_percent=50 num_groups=25.076k size=4.096k
GrouperWithMultiTypes/"{int32, boolean, utf8}"/4096/1 1399 us 1399 us 501 items_per_second=2.92779M/s null_percent=100 num_groups=1 size=4.096k
GrouperWithMultiTypes/"{int32, boolean, utf8}"/4096/0 1100 us 1100 us 613 items_per_second=3.72269M/s null_percent=0 num_groups=4.096k size=4.096k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/1024/10000 314 us 314 us 2263 items_per_second=3.25722M/s null_percent=0.01 num_groups=1.024k size=1.024k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/1024/100 506 us 506 us 1372 items_per_second=2.02275M/s null_percent=1 num_groups=1.63k size=1.024k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/1024/10 1515 us 1514 us 466 items_per_second=676.307k/s null_percent=10 num_groups=5.674k size=1.024k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/1024/2 4296 us 4295 us 163 items_per_second=238.424k/s null_percent=50 num_groups=11.405k size=1.024k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/1024/1 432 us 432 us 1655 items_per_second=2.37068M/s null_percent=100 num_groups=1 size=1.024k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/1024/0 311 us 311 us 2239 items_per_second=3.2934M/s null_percent=0 num_groups=1.024k size=1.024k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/4096/10000 1265 us 1264 us 551 items_per_second=3.23969M/s null_percent=0.01 num_groups=4.096k size=4.096k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/4096/100 2216 us 2216 us 319 items_per_second=1.84872M/s null_percent=1 num_groups=6.139k size=4.096k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/4096/10 7549 us 7547 us 91 items_per_second=542.731k/s null_percent=10 num_groups=22.322k size=4.096k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/4096/2 23964 us 23956 us 29 items_per_second=170.979k/s null_percent=50 num_groups=44.868k size=4.096k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/4096/1 1663 us 1663 us 423 items_per_second=2.46312M/s null_percent=100 num_groups=1 size=4.096k
GrouperWithMultiTypes/"{int32, int64, boolean, utf8}"/4096/0 1271 us 1271 us 549 items_per_second=3.22388M/s null_percent=0 num_groups=4.096k size=4.096k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/1024/10000 495 us 495 us 1389 items_per_second=2.06983M/s null_percent=0.01 num_groups=1.024k size=1.024k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/1024/100 802 us 802 us 883 items_per_second=1.27742M/s null_percent=1 num_groups=1.622k size=1.024k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/1024/10 2523 us 2522 us 281 items_per_second=405.964k/s null_percent=10 num_groups=6.011k size=1.024k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/1024/2 6945 us 6942 us 110 items_per_second=147.514k/s null_percent=50 num_groups=11.936k size=1.024k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/1024/1 626 us 626 us 933 items_per_second=1.63646M/s null_percent=100 num_groups=1 size=1.024k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/1024/0 513 us 513 us 1392 items_per_second=1.99517M/s null_percent=0 num_groups=1.024k size=1.024k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/4096/10000 2359 us 2359 us 294 items_per_second=1.73639M/s null_percent=0.01 num_groups=4.1k size=4.096k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/4096/100 3889 us 3888 us 178 items_per_second=1.05341M/s null_percent=1 num_groups=6.219k size=4.096k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/4096/10 13720 us 13715 us 50 items_per_second=298.661k/s null_percent=10 num_groups=24k size=4.096k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/4096/2 26470 us 26462 us 24 items_per_second=154.787k/s null_percent=50 num_groups=48.565k size=4.096k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/4096/1 2322 us 2322 us 302 items_per_second=1.7641M/s null_percent=100 num_groups=1 size=4.096k
GrouperWithMultiTypes/"{utf8, int32, int64, fixed_size_binary(128), boolean}"/4096/0 2070 us 2069 us 340 items_per_second=1.97969M/s null_percent=0 num_groups=4.096k size=4.096kAnd there is a bug which would cause compare null with a wrong result #40998 hasn't merged. So some of num_groups are wrong when are_cols_in_encoding_order=true.
like:
# are_cols_in_encoding_order=false
GrouperWithMultiTypes/"{int32, boolean, utf8}"/1024/2 324 us 324 us 2148 items_per_second=3.16498M/s null_percent=50 num_groups=730 size=1.024k
# are_cols_in_encoding_order=true
GrouperWithMultiTypes/"{int32, boolean, utf8}"/1024/2 4423 us 4422 us 158 items_per_second=231.569k/s null_percent=50 num_groups=6.386k size=1.024kThere was a problem hiding this comment.
I think it would be informative to output the number of distinct groups here. Something like:
| for (auto _ : state) { | |
| ASSIGN_OR_ABORT(auto grouper, Grouper::Make(span.GetTypes(), ctx)); | |
| for (int i = 0; i < kRound; ++i) { | |
| ASSIGN_OR_ABORT(auto group_ids, grouper->Consume(span)); | |
| } | |
| } | |
| state.SetItemsProcessed(state.iterations() * kRound * span.length); | |
| uint32_t num_groups = 0; | |
| for (auto _ : state) { | |
| ASSIGN_OR_ABORT(auto grouper, Grouper::Make(span.GetTypes(), ctx)); | |
| for (int i = 0; i < kRound; ++i) { | |
| ASSIGN_OR_ABORT(auto group_ids, grouper->Consume(span)); | |
| } | |
| num_groups = grouper->num_groups(); | |
| } | |
| state.SetItemsProcessed(state.iterations() * kRound * span.length); | |
| state.counters["num_groups"] = num_groups; | |
| state.counters["uniqueness"] = static_cast<double>(num_groups) / (kRound * span.length); |
There was a problem hiding this comment.
Given that some of the benchmark variations seem quite slow, we should reduce this to a smaller value, such as 16 perhaps.
|
I find it interesting that some benchmark variations fall to abysmal speeds, for example for {int32, int64}: but not the same benchmark for {int32, int32}: |
Ah, nice catch.
arrow/cpp/src/arrow/compute/row/compare_internal.cc Lines 176 to 199 in 6269317 |
|
@ZhangHuiGui I have lost track of what this PR's status is. Does it need to wait for other PRs? Do you intend to bring further changes to it? |
This PR is mainly used for Grouper performance testing and is relatively independent. A performance problem previously discovered(#41233) through this test will be fixed in other PRs. I think there is nothing that needs to be added in this PR. |
2978a6e to
aaf8dcc
Compare
|
@pitrou It looks like this PR can move forward? |
aaf8dcc to
14cbc5f
Compare
|
After merging your PR, Conbench analyzed the 7 benchmarking runs that have been run so far on merge-commit 28ab4af. There were no benchmark performance regressions. 🎉 The full Conbench report has more details. It also includes information about 5 possible false positives for unstable benchmarks that are known to sometimes produce them. |
…nce regression (apache#41036) ### Rationale for this change Add a grouper benchmark for preventing performance regression . apache#40998 (comment). ### What changes are included in this PR? Added a benchmark. ### Are these changes tested? Needn't. ### Are there any user-facing changes? No * GitHub Issue: apache#41035 Authored-by: ZhangHuiGui <hugo.zhang@openpie.com> Signed-off-by: Antoine Pitrou <antoine@python.org>


Rationale for this change
Add a grouper benchmark for preventing performance regression .
#40998 (comment).
What changes are included in this PR?
Added a benchmark.
Are these changes tested?
Needn't.
Are there any user-facing changes?
No