Commit 8d02407
authored
perf: use filter instead of take in Patches::filter (#2093)
Replace usage of `take` with `filter` in `Patches::filter`.
Take performs a per-element binary search over `patch_indices`, which is
unnecessary can can just be performed using a filter after building the
sorted filter mask.
Benchmark results before/after change (with `-C target-cpu=native`
applied):
**BEFORE**
```
filter_then_canonical/0.001
time: [18.591 µs 18.646 µs 18.703 µs]
change: [-2.2719% -1.8183% -1.3886%] (p = 0.00 < 0.05)
Performance has improved.
Found 7 outliers among 100 measurements (7.00%)
3 (3.00%) high mild
4 (4.00%) high severe
filter_then_canonical/0.01
time: [45.116 µs 45.287 µs 45.469 µs]
change: [+0.9772% +1.3910% +1.8349%] (p = 0.00 < 0.05)
Change within noise threshold.
Found 1 outliers among 100 measurements (1.00%)
1 (1.00%) high mild
filter_then_canonical/0.1
time: [55.525 µs 55.895 µs 56.334 µs]
change: [-9.1744% -8.2913% -7.4359%] (p = 0.00 < 0.05)
Performance has improved.
Found 4 outliers among 100 measurements (4.00%)
4 (4.00%) high mild
filter_then_canonical/0.5
time: [167.36 µs 168.97 µs 170.64 µs]
change: [-6.8090% -5.6899% -4.6273%] (p = 0.00 < 0.05)
Performance has improved.
filter_then_canonical/0.9
time: [267.43 µs 274.14 µs 280.44 µs]
change: [-5.1936% -0.6966% +3.0989%] (p = 0.77 > 0.05)
No change in performance detected.
Found 2 outliers among 100 measurements (2.00%)
2 (2.00%) high mild
filter_then_canonical/0.99
time: [218.80 µs 222.99 µs 227.39 µs]
change: [-12.117% -9.8998% -7.5168%] (p = 0.00 < 0.05)
Performance has improved.
Found 2 outliers among 100 measurements (2.00%)
2 (2.00%) high mild
filter_then_canonical/0.999
time: [235.28 µs 242.05 µs 249.06 µs]
change: [+7.4971% +11.002% +14.803%] (p = 0.00 < 0.05)
Performance has regressed.
filter_then_canonical/1 time: [44.103 µs 44.969 µs 45.811 µs]
change: [+1.1924% +2.5506% +4.0096%] (p = 0.00 < 0.05)
Performance has regressed.
Found 16 outliers among 100 measurements (16.00%)
6 (6.00%) high mild
10 (10.00%) high severe
canonical_then_filter/0.001
time: [42.622 µs 42.801 µs 43.047 µs]
change: [+2.8863% +3.8982% +5.2951%] (p = 0.00 < 0.05)
Performance has regressed.
Found 12 outliers among 100 measurements (12.00%)
12 (12.00%) high mild
canonical_then_filter/0.01
time: [45.406 µs 46.116 µs 46.893 µs]
change: [+7.4139% +8.7784% +10.114%] (p = 0.00 < 0.05)
Performance has regressed.
canonical_then_filter/0.1
time: [55.605 µs 57.323 µs 59.165 µs]
change: [-3.8630% -1.9663% -0.0013%] (p = 0.06 > 0.05)
No change in performance detected.
Found 13 outliers among 100 measurements (13.00%)
12 (12.00%) low mild
1 (1.00%) high mild
canonical_then_filter/0.5
time: [58.457 µs 59.673 µs 61.200 µs]
change: [-3.9607% -1.5104% +0.6748%] (p = 0.23 > 0.05)
No change in performance detected.
canonical_then_filter/0.9
time: [101.31 µs 102.97 µs 104.51 µs]
change: [-5.6743% -4.0261% -2.4754%] (p = 0.00 < 0.05)
Performance has improved.
canonical_then_filter/0.99
time: [71.770 µs 72.499 µs 73.223 µs]
change: [+12.322% +14.444% +16.977%] (p = 0.00 < 0.05)
Performance has regressed.
Found 4 outliers among 100 measurements (4.00%)
1 (1.00%) low mild
1 (1.00%) high mild
2 (2.00%) high severe
canonical_then_filter/0.999
time: [70.196 µs 71.040 µs 71.869 µs]
change: [+0.7287% +1.7791% +2.9515%] (p = 0.00 < 0.05)
Change within noise threshold.
Found 7 outliers among 100 measurements (7.00%)
2 (2.00%) low mild
4 (4.00%) high mild
1 (1.00%) high severe
canonical_then_filter/1 time: [46.668 µs 47.762 µs 48.889 µs]
change: [+0.7750% +3.1566% +5.6672%] (p = 0.01 < 0.05)
Change within noise threshold.
```
**AFTER**
```
filter_then_canonical/0.001
time: [14.971 µs 15.118 µs 15.310 µs]
change: [-20.044% -19.194% -18.225%] (p = 0.00 < 0.05)
Performance has improved.
Found 13 outliers among 100 measurements (13.00%)
8 (8.00%) high mild
5 (5.00%) high severe
filter_then_canonical/0.01
time: [25.974 µs 26.012 µs 26.053 µs]
change: [-42.546% -42.237% -41.891%] (p = 0.00 < 0.05)
Performance has improved.
Found 12 outliers among 100 measurements (12.00%)
8 (8.00%) high mild
4 (4.00%) high severe
filter_then_canonical/0.1
time: [59.520 µs 59.888 µs 60.260 µs]
change: [+6.8618% +7.8890% +8.9357%] (p = 0.00 < 0.05)
Performance has regressed.
Found 5 outliers among 100 measurements (5.00%)
5 (5.00%) high mild
filter_then_canonical/0.5
time: [167.38 µs 169.59 µs 171.66 µs]
change: [-2.4051% -1.4161% -0.3761%] (p = 0.01 < 0.05)
Change within noise threshold.
Found 29 outliers among 100 measurements (29.00%)
8 (8.00%) low severe
2 (2.00%) low mild
3 (3.00%) high mild
16 (16.00%) high severe
filter_then_canonical/0.9
time: [258.88 µs 259.30 µs 259.76 µs]
change: [-5.1144% -3.5762% -2.0444%] (p = 0.00 < 0.05)
Performance has improved.
Found 5 outliers among 100 measurements (5.00%)
2 (2.00%) high mild
3 (3.00%) high severe
filter_then_canonical/0.99
time: [187.55 µs 189.52 µs 191.52 µs]
change: [-13.451% -11.806% -10.251%] (p = 0.00 < 0.05)
Performance has improved.
filter_then_canonical/0.999
time: [179.95 µs 181.57 µs 182.99 µs]
change: [-32.654% -30.839% -28.982%] (p = 0.00 < 0.05)
Performance has improved.
filter_then_canonical/1 time: [42.540 µs 42.615 µs 42.681 µs]
change: [-3.6925% -2.5866% -1.5384%] (p = 0.00 < 0.05)
Performance has improved.
canonical_then_filter/0.001
time: [42.678 µs 42.759 µs 42.828 µs]
change: [-4.6690% -3.5527% -2.5030%] (p = 0.00 < 0.05)
Performance has improved.
canonical_then_filter/0.01
time: [47.107 µs 47.695 µs 48.234 µs]
change: [+2.0595% +3.5847% +5.1306%] (p = 0.00 < 0.05)
Performance has regressed.
Found 26 outliers among 100 measurements (26.00%)
13 (13.00%) low severe
6 (6.00%) high mild
7 (7.00%) high severe
canonical_then_filter/0.1
time: [61.105 µs 61.594 µs 62.052 µs]
change: [-1.7992% +0.2192% +2.3952%] (p = 0.84 > 0.05)
No change in performance detected.
canonical_then_filter/0.5
time: [69.184 µs 69.549 µs 69.928 µs]
change: [+2.6673% +5.1603% +7.8241%] (p = 0.00 < 0.05)
Performance has regressed.
Found 2 outliers among 100 measurements (2.00%)
2 (2.00%) low mild
canonical_then_filter/0.9
time: [103.06 µs 103.93 µs 104.90 µs]
change: [+4.4514% +6.2341% +7.9956%] (p = 0.00 < 0.05)
Performance has regressed.
canonical_then_filter/0.99
time: [68.937 µs 69.321 µs 69.680 µs]
change: [-8.9882% -7.3397% -5.9331%] (p = 0.00 < 0.05)
Performance has improved.
Found 11 outliers among 100 measurements (11.00%)
9 (9.00%) low mild
2 (2.00%) high mild
canonical_then_filter/0.999
time: [67.411 µs 67.657 µs 67.917 µs]
change: [-5.0588% -4.0257% -2.9739%] (p = 0.00 < 0.05)
Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
1 (1.00%) high mild
canonical_then_filter/1 time: [44.883 µs 45.997 µs 46.996 µs]
change: [-4.4256% -2.0499% +0.2734%] (p = 0.09 > 0.05)
No change in performance detected.
```1 parent f17f32e commit 8d02407
File tree
5 files changed
+222
-28
lines changed- bench-vortex
- benches
- vortex-array/src
5 files changed
+222
-28
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| |||
100 | 101 | | |
101 | 102 | | |
102 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
7 | | - | |
| 9 | + | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
15 | | - | |
16 | | - | |
| 17 | + | |
| 18 | + | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| |||
212 | 214 | | |
213 | 215 | | |
214 | 216 | | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | 217 | | |
222 | 218 | | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
242 | 225 | | |
243 | 226 | | |
244 | 227 | | |
| |||
396 | 379 | | |
397 | 380 | | |
398 | 381 | | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
399 | 473 | | |
400 | 474 | | |
401 | 475 | | |
| |||
0 commit comments