Mola-maker commented on PR #12327:
URL: https://github.com/apache/arrow-rs/pull/12327#issuecomment-7000456997

   @Rich-T-kid I dug into this. Here is what I found.
   
   I re-ran both benches locally on an AMD EPYC box, twice each from clean 
rebuilds, before and after the change. On the overflow bench the fix makes 
things much faster there: 128 goes from 41.9 to 17.7µs, 256 from 64.3 to 
39.2µs, and the second clean rebuild reproduces both numbers. I also confirmed 
the mechanism: in the pre-fix binary `is_valid_decimal_precision` still exists 
as a standalone out-of-line function, so without the attribute every element 
pays a real call.
   
   So the GKE 256 slowdown is not a universal effect of the change, it flips 
sign across hardware. The most likely explanation: on the GKE Intel node the 
out-of-order engine hides the call cost, so inlining the largest of the four 
checks (the 256-bit one does two 4-limb i256 compares plus table lookups) into 
the tight loop costs more in code size and register pressure than the call 
saves. On the AMD box the per-element call dominates instead, so inlining wins 
big.
   
   On cast_decimal locally the picture matches GKE in shape: the 128 fallible 
paths are 13-14% faster with the fix, the 256 downscale paths are about flat to 
slightly slower, small/1 and small/16 are faster. And neither bench covers the 
workload that motivated the issue (Comet's per-row accumulator calls, 
cross-crate); the 10-37% figure in the issue came from Comet's own criterion 
bench.
   
   A re-run on GKE would still help to see whether the 256 regression 
reproduces. If it does, I am happy to scope the change to 32/64/128.


-- 
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