Commit d674aa2
authored
fix[vortex-array]: avoid unnecessary checks in check_listview_constant (#7423)
## Summary
ListView sizes are checked on each element iteration. This can cause
unecessary calls to arrays_value_equal if most but not all sizes are
equal. This commit pulls up some fast checks we can do before executing
the expensive arrays_value_equal loop. Concretely, only execute the loop
if all sizes are equal *and* non-zero *and* offsets are not all equal,
since the inverse is trivially constant.
[Profile link here, we're seeing that this check is
expensive](https://pprof.me/39a57fd47bacf99f6669aa6ba5beed31/?profile_filters=p%3Ahide_libc%3AHide%2520libc%2Cp%3Ahide_tokio_frames%3AHide%2520Tokio%2520Frames%2Cp%3Ahide_rust_futures%3AHide%2520Rust%2520Futures%2520Infrastructure%2Cp%3Ahide_rust_panic_backtrace%3AHide%2520Rust%2520Panic%2520Backtrace%2520Infrastructure)
Signed-off-by: Alfonso Subiotto Marques <alfonso.subiotto@polarsignals.com>1 parent d222c87 commit d674aa2
1 file changed
Lines changed: 16 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
23 | 29 | | |
24 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
25 | 38 | | |
| 39 | + | |
| 40 | + | |
26 | 41 | | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | 42 | | |
34 | 43 | | |
35 | 44 | | |
| |||
0 commit comments