mbutrovich commented on PR #12419:
URL: https://github.com/apache/arrow-rs/pull/12419#issuecomment-7111707756

   The PR went through three heads before the current description. Each fixed 
regressions the bot runs on the previous one showed.
   
   - 403a4ed6a7 checked every slot against two bounds before dividing, and 
again against the native type's bounds when the narrow check failed. At nine 
tenths null that scan cost more than the division it saved.
   - 51067797b0 replaced the scan with one OR-fold on the `unary` path, and on 
the `try_unary` path checked each valid value with `checked_mul` and a bounds 
test instead of scanning. The per-value closure didn't inline, so every valid 
value made a call, and three quarters null fell below the baseline on the Xeon.
   - 1397548746 runs the OR-fold on both paths and picks the divisor once per 
array, so the `try_unary` loop divides with the enum's `wrapping_div_rem` and 
makes no call. It also moves `Decimal64` to `try_unary` above a quarter null, 
because on the Xeon its `unary` loop over every slot lost to the baseline at 
half null.
   
   Speedup over the baseline in the aligned runs:
   
   | Case | Neoverse-V2, 
[403a4ed6a7](https://github.com/apache/arrow-rs/pull/12419#issuecomment-7105918761)
 | 
[51067797b0](https://github.com/apache/arrow-rs/pull/12419#issuecomment-7108204171)
 | 
[1397548746](https://github.com/apache/arrow-rs/pull/12419#issuecomment-7111168777)
 | Xeon 8581C, 
[403a4ed6a7](https://github.com/apache/arrow-rs/pull/12419#issuecomment-7105944644)
 | 
[51067797b0](https://github.com/apache/arrow-rs/pull/12419#issuecomment-7108243993)
 | 
[1397548746](https://github.com/apache/arrow-rs/pull/12419#issuecomment-7110474566)
 |
   |---|--:|--:|--:|--:|--:|--:|
   | `Decimal128 /`, nine tenths null | 0.63x | 1.26x | 0.90x | 0.91x | 0.81x | 
1.29x |
   | `Decimal128 /`, three quarters null | 1.06x | 1.33x | 1.38x | 1.69x | 
0.90x | 2.19x |
   | `Decimal128 %`, nine tenths null | 0.56x | 1.16x | 0.84x | 0.90x | 0.88x | 
1.23x |
   | `Decimal256 /`, nine tenths null | 1.03x | 1.36x | 1.75x | 0.83x | 1.26x | 
1.35x |
   | `Decimal64 /`, half null | 1.49x | 1.55x | 1.78x | 0.64x | 0.81x | 1.51x |
   
   Checking each valid value was faster at nine tenths null on Neoverse-V2, but 
slower on the Xeon in every case above, so the current head keeps the 
batch-level choice.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to