You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "zhuqi-lucas (via GitHub)" <gi...@apache.org> on 2025/06/23 10:05:12 UTC
[PR] Perf: Optimize CursorValues compare performance for StringViewArray (1.6 faster for sort-tpch Q11) [datafusion]
zhuqi-lucas opened a new pull request, #16509:
URL: https://github.com/apache/datafusion/pull/16509
## Which issue does this PR close?
- Closes [#16508](https://github.com/apache/datafusion/issues/16508)
## Rationale for this change
Add fast path for CursorValues compare performance for StringViewArray.
## What changes are included in this PR?
Add fast path for CursorValues compare performance for StringViewArray if the data buffer is empty, which can avoid len compare for following logic.
## Are these changes tested?
Yes
## Are there any user-facing changes?
No
<!--
If there are any breaking changes to public APIs, please add the `api change` label.
-->
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Perf: Optimize CursorValues compare performance for StringViewArray (1.4X faster for sort-tpch Q11) [datafusion]
Posted by "Dandandan (via GitHub)" <gi...@apache.org>.
Dandandan commented on PR #16509:
URL: https://github.com/apache/datafusion/pull/16509#issuecomment-2998041649
> ๐ค: Benchmark completed
>
> Details
had a look at the "regressions", I think should not be impacted by this change (thus noise).
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Perf: Optimize CursorValues compare performance for StringViewArray (1.4X faster for sort-tpch Q11) [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #16509:
URL: https://github.com/apache/datafusion/pull/16509#discussion_r2161855265
##########
datafusion/physical-plan/src/sorts/cursor.rs:
##########
@@ -293,14 +293,19 @@ impl CursorValues for StringViewArray {
self.views().len()
}
+ #[inline(always)]
Review Comment:
For anyone else following along, I believe this is the same optimization as applied in
- https://github.com/apache/arrow-rs/pull/7731
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Perf: Optimize CursorValues compare performance for StringViewArray (1.4X faster for sort-tpch Q11) [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #16509:
URL: https://github.com/apache/datafusion/pull/16509#issuecomment-2997163295
๐ค `./gh_compare_branch.sh` [Benchmark Script](https://github.com/alamb/datafusion-benchmarking/blob/main/gh_compare_branch.sh) Running
Linux aal-dev 6.11.0-1015-gcp #15~24.04.1-Ubuntu SMP Thu Apr 24 20:41:05 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Comparing fast_path_view (f22ca3c9863943ab31e8e9966057d13fd694c71c) to 2bf8441c8b2272116409fd49af9b06fb72ed0495 [diff](https://github.com/apache/datafusion/compare/2bf8441c8b2272116409fd49af9b06fb72ed0495..f22ca3c9863943ab31e8e9966057d13fd694c71c)
Benchmarks: tpch_mem clickbench_partitioned clickbench_extended
Results will be posted here when complete
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Perf: Optimize CursorValues compare performance for StringViewArray (1.4X faster for sort-tpch Q11) [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #16509:
URL: https://github.com/apache/datafusion/pull/16509#issuecomment-2997267521
๐ค: Benchmark completed
<details><summary>Details</summary>
<p>
```
Comparing HEAD and fast_path_view
--------------------
Benchmark clickbench_extended.json
--------------------
โโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโ
โ Query โ HEAD โ fast_path_view โ Change โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ QQuery 0 โ 1988.57 ms โ 2142.83 ms โ 1.08x slower โ
โ QQuery 1 โ 718.95 ms โ 707.35 ms โ no change โ
โ QQuery 2 โ 1381.41 ms โ 1385.85 ms โ no change โ
โ QQuery 3 โ 648.24 ms โ 686.89 ms โ 1.06x slower โ
โ QQuery 4 โ 1372.37 ms โ 1370.82 ms โ no change โ
โ QQuery 5 โ 15173.88 ms โ 15217.15 ms โ no change โ
โ QQuery 6 โ 2082.96 ms โ 2023.77 ms โ no change โ
โ QQuery 7 โ 2049.36 ms โ 2028.40 ms โ no change โ
โ QQuery 8 โ 805.76 ms โ 820.48 ms โ no change โ
โโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโ
โ Benchmark Summary โ โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ Total Time (HEAD) โ 26221.51ms โ
โ Total Time (fast_path_view) โ 26383.55ms โ
โ Average Time (HEAD) โ 2913.50ms โ
โ Average Time (fast_path_view) โ 2931.51ms โ
โ Queries Faster โ 0 โ
โ Queries Slower โ 2 โ
โ Queries with No Change โ 7 โ
โ Queries with Failure โ 0 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโ
--------------------
Benchmark clickbench_partitioned.json
--------------------
โโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโ
โ Query โ HEAD โ fast_path_view โ Change โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ QQuery 0 โ 2.26 ms โ 2.37 ms โ no change โ
โ QQuery 1 โ 34.52 ms โ 33.99 ms โ no change โ
โ QQuery 2 โ 82.25 ms โ 81.73 ms โ no change โ
โ QQuery 3 โ 91.96 ms โ 101.59 ms โ 1.10x slower โ
โ QQuery 4 โ 670.29 ms โ 595.46 ms โ +1.13x faster โ
โ QQuery 5 โ 924.74 ms โ 848.52 ms โ +1.09x faster โ
โ QQuery 6 โ 2.29 ms โ 2.23 ms โ no change โ
โ QQuery 7 โ 39.12 ms โ 39.60 ms โ no change โ
โ QQuery 8 โ 875.61 ms โ 869.89 ms โ no change โ
โ QQuery 9 โ 1203.04 ms โ 1148.95 ms โ no change โ
โ QQuery 10 โ 256.35 ms โ 258.61 ms โ no change โ
โ QQuery 11 โ 290.28 ms โ 285.61 ms โ no change โ
โ QQuery 12 โ 911.90 ms โ 874.02 ms โ no change โ
โ QQuery 13 โ 1264.11 ms โ 1274.50 ms โ no change โ
โ QQuery 14 โ 835.77 ms โ 826.75 ms โ no change โ
โ QQuery 15 โ 788.25 ms โ 793.46 ms โ no change โ
โ QQuery 16 โ 1661.81 ms โ 1673.49 ms โ no change โ
โ QQuery 17 โ 1613.20 ms โ 1632.61 ms โ no change โ
โ QQuery 18 โ 2995.68 ms โ 2969.08 ms โ no change โ
โ QQuery 19 โ 88.59 ms โ 84.39 ms โ no change โ
โ QQuery 20 โ 1171.81 ms โ 1139.65 ms โ no change โ
โ QQuery 21 โ 1320.01 ms โ 1283.02 ms โ no change โ
โ QQuery 22 โ 2171.26 ms โ 2095.38 ms โ no change โ
โ QQuery 23 โ 7442.25 ms โ 7410.28 ms โ no change โ
โ QQuery 24 โ 472.94 ms โ 453.60 ms โ no change โ
โ QQuery 25 โ 402.89 ms โ 395.16 ms โ no change โ
โ QQuery 26 โ 526.97 ms โ 514.73 ms โ no change โ
โ QQuery 27 โ 1579.76 ms โ 1525.91 ms โ no change โ
โ QQuery 28 โ 13130.51 ms โ 11906.74 ms โ +1.10x faster โ
โ QQuery 29 โ 539.36 ms โ 514.08 ms โ no change โ
โ QQuery 30 โ 800.47 ms โ 777.46 ms โ no change โ
โ QQuery 31 โ 822.87 ms โ 818.04 ms โ no change โ
โ QQuery 32 โ 2525.29 ms โ 2559.95 ms โ no change โ
โ QQuery 33 โ 3219.31 ms โ 3228.55 ms โ no change โ
โ QQuery 34 โ 3323.28 ms โ 3244.18 ms โ no change โ
โ QQuery 35 โ 1282.15 ms โ 1269.19 ms โ no change โ
โ QQuery 36 โ 122.16 ms โ 122.21 ms โ no change โ
โ QQuery 37 โ 53.36 ms โ 49.92 ms โ +1.07x faster โ
โ QQuery 38 โ 119.63 ms โ 119.59 ms โ no change โ
โ QQuery 39 โ 203.97 ms โ 196.17 ms โ no change โ
โ QQuery 40 โ 42.37 ms โ 42.41 ms โ no change โ
โ QQuery 41 โ 38.85 ms โ 38.38 ms โ no change โ
โ QQuery 42 โ 31.93 ms โ 33.52 ms โ 1.05x slower โ
โโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโ
โ Benchmark Summary โ โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ Total Time (HEAD) โ 55975.43ms โ
โ Total Time (fast_path_view) โ 54134.99ms โ
โ Average Time (HEAD) โ 1301.75ms โ
โ Average Time (fast_path_view) โ 1258.95ms โ
โ Queries Faster โ 4 โ
โ Queries Slower โ 2 โ
โ Queries with No Change โ 37 โ
โ Queries with Failure โ 0 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโ
--------------------
Benchmark tpch_mem_sf1.json
--------------------
โโโโโโโโโโโโโโโโณโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโ
โ Query โ HEAD โ fast_path_view โ Change โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ QQuery 1 โ 103.20 ms โ 103.84 ms โ no change โ
โ QQuery 2 โ 21.07 ms โ 20.58 ms โ no change โ
โ QQuery 3 โ 32.68 ms โ 32.00 ms โ no change โ
โ QQuery 4 โ 18.60 ms โ 18.70 ms โ no change โ
โ QQuery 5 โ 50.00 ms โ 48.53 ms โ no change โ
โ QQuery 6 โ 11.86 ms โ 11.95 ms โ no change โ
โ QQuery 7 โ 86.84 ms โ 88.45 ms โ no change โ
โ QQuery 8 โ 25.11 ms โ 25.03 ms โ no change โ
โ QQuery 9 โ 54.79 ms โ 54.82 ms โ no change โ
โ QQuery 10 โ 43.38 ms โ 42.97 ms โ no change โ
โ QQuery 11 โ 11.47 ms โ 11.33 ms โ no change โ
โ QQuery 12 โ 34.12 ms โ 34.13 ms โ no change โ
โ QQuery 13 โ 25.94 ms โ 26.54 ms โ no change โ
โ QQuery 14 โ 9.78 ms โ 9.75 ms โ no change โ
โ QQuery 15 โ 18.83 ms โ 19.84 ms โ 1.05x slower โ
โ QQuery 16 โ 18.81 ms โ 18.78 ms โ no change โ
โ QQuery 17 โ 96.22 ms โ 95.89 ms โ no change โ
โ QQuery 18 โ 191.84 ms โ 195.57 ms โ no change โ
โ QQuery 19 โ 24.92 ms โ 25.16 ms โ no change โ
โ QQuery 20 โ 31.73 ms โ 31.82 ms โ no change โ
โ QQuery 21 โ 144.91 ms โ 148.56 ms โ no change โ
โ QQuery 22 โ 15.07 ms โ 15.09 ms โ no change โ
โโโโโโโโโโโโโโโโดโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโ
โ Benchmark Summary โ โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ Total Time (HEAD) โ 1071.19ms โ
โ Total Time (fast_path_view) โ 1079.35ms โ
โ Average Time (HEAD) โ 48.69ms โ
โ Average Time (fast_path_view) โ 49.06ms โ
โ Queries Faster โ 0 โ
โ Queries Slower โ 1 โ
โ Queries with No Change โ 21 โ
โ Queries with Failure โ 0 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโ
```
</p>
</details>
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Perf: Optimize CursorValues compare performance for StringViewArray (1.4X faster for sort-tpch Q11) [datafusion]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead merged PR #16509:
URL: https://github.com/apache/datafusion/pull/16509
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Perf: Optimize CursorValues compare performance for StringViewArray (1.4X faster for sort-tpch Q11) [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #16509:
URL: https://github.com/apache/datafusion/pull/16509#issuecomment-2997270770
๐ค: Benchmark completed
<details><summary>Details</summary>
<p>
```
Comparing HEAD and fast_path_view
--------------------
Benchmark sort_tpch.json
--------------------
โโโโโโโโโโโโโโโโณโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโ
โ Query โ HEAD โ fast_path_view โ Change โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ Q1 โ 350.37 ms โ 347.24 ms โ no change โ
โ Q2 โ 301.59 ms โ 300.50 ms โ no change โ
โ Q3 โ 1164.84 ms โ 1187.22 ms โ no change โ
โ Q4 โ 412.28 ms โ 410.15 ms โ no change โ
โ Q5 โ 414.43 ms โ 407.09 ms โ no change โ
โ Q6 โ 445.56 ms โ 447.95 ms โ no change โ
โ Q7 โ 902.09 ms โ 888.45 ms โ no change โ
โ Q8 โ 819.94 ms โ 777.72 ms โ +1.05x faster โ
โ Q9 โ 848.95 ms โ 801.57 ms โ +1.06x faster โ
โ Q10 โ 1226.96 ms โ 1196.23 ms โ no change โ
โ Q11 โ 750.22 ms โ 694.11 ms โ +1.08x faster โ
โโโโโโโโโโโโโโโโดโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโ
โ Benchmark Summary โ โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ Total Time (HEAD) โ 7637.22ms โ
โ Total Time (fast_path_view) โ 7458.23ms โ
โ Average Time (HEAD) โ 694.29ms โ
โ Average Time (fast_path_view) โ 678.02ms โ
โ Queries Faster โ 3 โ
โ Queries Slower โ 0 โ
โ Queries with No Change โ 8 โ
โ Queries with Failure โ 0 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโ
```
</p>
</details>
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Perf: Optimize CursorValues compare performance for StringViewArray (1.6 faster for sort-tpch Q11) [datafusion]
Posted by "zhuqi-lucas (via GitHub)" <gi...@apache.org>.
zhuqi-lucas commented on PR #16509:
URL: https://github.com/apache/datafusion/pull/16509#issuecomment-2995786891
Test result:
```rust
--------------------
โโโโโโโโโโโโโโโโณโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโ
โ Query โ main โ fast_path_view โ Change โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ Q1 โ 106.56 ms โ 106.53 ms โ no change โ
โ Q2 โ 107.52 ms โ 104.28 ms โ no change โ
โ Q3 โ 666.52 ms โ 677.66 ms โ no change โ
โ Q4 โ 128.45 ms โ 127.80 ms โ no change โ
โ Q5 โ 258.79 ms โ 260.39 ms โ no change โ
โ Q6 โ 271.88 ms โ 271.11 ms โ no change โ
โ Q7 โ 427.24 ms โ 415.86 ms โ no change โ
โ Q8 โ 305.82 ms โ 303.95 ms โ no change โ
โ Q9 โ 316.23 ms โ 316.75 ms โ no change โ
โ Q10 โ 470.93 ms โ 467.82 ms โ no change โ
โ Q11 โ 281.10 ms โ 197.90 ms โ +1.42x 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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Perf: Optimize CursorValues compare performance for StringViewArray (1.4X faster for sort-tpch Q11) [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #16509:
URL: https://github.com/apache/datafusion/pull/16509#issuecomment-2997267614
๐ค `./gh_compare_branch.sh` [Benchmark Script](https://github.com/alamb/datafusion-benchmarking/blob/main/gh_compare_branch.sh) Running
Linux aal-dev 6.11.0-1015-gcp #15~24.04.1-Ubuntu SMP Thu Apr 24 20:41:05 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Comparing fast_path_view (f22ca3c9863943ab31e8e9966057d13fd694c71c) to 2bf8441c8b2272116409fd49af9b06fb72ed0495 [diff](https://github.com/apache/datafusion/compare/2bf8441c8b2272116409fd49af9b06fb72ed0495..f22ca3c9863943ab31e8e9966057d13fd694c71c)
Benchmarks: sort_tpch
Results will be posted here when complete
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org