Commit a1e482c
authored
[opt](sort)use HybridSorter to choose between timsort and pdqsort (#59207)
### What problem does this PR solve?
Timsort is faster than pdqsort for partially-ordered data.
Introduce a HybridSorter that samples at sort time to choose between
timsort and pdqsort.
This optimization can be disabled with enable_use_hybrid_sort; it is
enabled by default.
```
Run on (128 X 2250.02 MHz CPU s)
CPU Caches:
L1 Data 32 KiB (x64)
L1 Instruction 32 KiB (x64)
L2 Unified 1024 KiB (x64)
L3 Unified 16384 KiB (x8)
Load Average: 36.25, 46.31, 138.22
--------------------------------------------------------------------------------
Benchmark Time CPU Iterations UserCounters...
--------------------------------------------------------------------------------
BM_PdqSort/10000000/0 350 ms 350 ms 2 items_per_second=28.5574M/s random
BM_PdqSort/10000000/1 216 ms 216 ms 3 items_per_second=46.3077M/s ascending_saw
BM_PdqSort/10000000/2 217 ms 217 ms 3 items_per_second=46.1045M/s descending_saw
BM_PdqSort/10000000/3 274 ms 274 ms 3 items_per_second=36.4636M/s generic
BM_PdqSort/10000000/4 326 ms 326 ms 2 items_per_second=30.6559M/s random_tail
BM_PdqSort/10000000/5 346 ms 346 ms 2 items_per_second=28.8922M/s random_half
BM_PdqSort/10000000/6 230 ms 230 ms 3 items_per_second=43.5162M/s wave
BM_TimSort/10000000/0 1113 ms 1113 ms 1 items_per_second=8.98417M/s random
BM_TimSort/10000000/1 89.9 ms 89.9 ms 8 items_per_second=111.209M/s ascending_saw
BM_TimSort/10000000/2 91.0 ms 91.0 ms 8 items_per_second=109.926M/s descending_saw
BM_TimSort/10000000/3 533 ms 533 ms 1 items_per_second=18.7505M/s generic
BM_TimSort/10000000/4 228 ms 228 ms 3 items_per_second=43.7805M/s random_tail
BM_TimSort/10000000/5 559 ms 559 ms 1 items_per_second=17.8817M/s random_half
BM_TimSort/10000000/6 87.4 ms 87.4 ms 8 items_per_second=114.384M/s wave
```1 parent 9d34c04 commit a1e482c
File tree
45 files changed
+352
-90
lines changed- be
- src
- pipeline/exec
- runtime
- vec
- aggregate_functions
- columns
- common/sort
- core
- test
- pipeline/operator
- testutil/mock
- vec
- columns
- data_types
- exec/sort
- fe/fe-core/src/main/java/org/apache/doris/qe
- gensrc/thrift
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
45 files changed
+352
-90
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
52 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
687 | 687 | | |
688 | 688 | | |
689 | 689 | | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
690 | 695 | | |
691 | 696 | | |
692 | 697 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
114 | 117 | | |
115 | 118 | | |
116 | 119 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
491 | 492 | | |
492 | 493 | | |
493 | 494 | | |
494 | | - | |
| 495 | + | |
495 | 496 | | |
496 | 497 | | |
497 | 498 | | |
498 | 499 | | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
499 | 508 | | |
500 | 509 | | |
501 | 510 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
244 | | - | |
| 244 | + | |
245 | 245 | | |
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
252 | | - | |
| 252 | + | |
253 | 253 | | |
254 | | - | |
| 254 | + | |
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
174 | | - | |
| 174 | + | |
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
| 104 | + | |
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
228 | | - | |
| 228 | + | |
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
289 | | - | |
| 289 | + | |
290 | 290 | | |
291 | | - | |
292 | 291 | | |
293 | 292 | | |
294 | | - | |
| 293 | + | |
295 | 294 | | |
296 | 295 | | |
297 | 296 | | |
298 | 297 | | |
299 | 298 | | |
300 | | - | |
301 | 299 | | |
302 | 300 | | |
303 | 301 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
188 | | - | |
| 188 | + | |
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
| |||
264 | 264 | | |
265 | 265 | | |
266 | 266 | | |
267 | | - | |
| 267 | + | |
| 268 | + | |
268 | 269 | | |
269 | 270 | | |
270 | 271 | | |
| |||
280 | 281 | | |
281 | 282 | | |
282 | 283 | | |
283 | | - | |
284 | | - | |
| 284 | + | |
| 285 | + | |
285 | 286 | | |
286 | | - | |
287 | | - | |
| 287 | + | |
| 288 | + | |
288 | 289 | | |
289 | 290 | | |
290 | 291 | | |
| |||
0 commit comments