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

   The benchmark bot runs on this PR compare 7d3e750 to itself, so the base and 
changed columns differ only by noise (ratios from 1.00 to 1.04). The comparison 
that matters is inside each run. For each type, `operator` divides with `/` or 
`%` by a divisor hidden behind `black_box`, and `divisor` uses `div_rem`. The 
charts show `operator` time divided by `divisor` time, from the changed column 
of the [x86 
run](https://github.com/apache/arrow-rs/pull/11467#issuecomment-6070711331) and 
the [arm64 
run](https://github.com/apache/arrow-rs/pull/11467#issuecomment-6070944047).
   
   <img width="1600" height="1380" alt="divisor-types-bot-x86" 
src="https://github.com/user-attachments/assets/a47bcd33-a79b-47a2-86c2-6a6a363a9428";
 />
   
   <img width="1600" height="1380" alt="divisor-types-bot-arm" 
src="https://github.com/user-attachments/assets/01fba4a8-f299-40dc-b7b5-a3723912e940";
 />
   
   
   `div_rem` is faster than `/` and `%` in all 32 cases. The smallest gain is 
1.4x, for `i32 % 13` on x86.
   
   On Neoverse-V2, `/` and `%` by 16 take 14 to 17 us, against 30 to 56 us by 
13. That faster baseline is why several divide-by-16 bars are shorter than the 
divide-by-13 bars on arm64, even though `div_rem` by 16 is a shift or a mask.
   
   <details><summary>Numbers behind the charts (us per 8192 values)</summary>
   
   | Case | x86 `operator` | x86 `divisor` | x86 speedup | arm64 `operator` | 
arm64 `divisor` | arm64 speedup |
   |---|---|---|---|---|---|---|
   | `u32 / 13` | 12.0 | 1.75 | 6.9x | 31.5 | 1.69 | 18.7x |
   | `u32 % 13` | 12.0 | 6.2 | 1.9x | 34.2 | 6.0 | 5.7x |
   | `i32 / 13` | 12.0 | 8.0 | 1.5x | 30.0 | 8.8 | 3.4x |
   | `i32 % 13` | 11.9 | 8.4 | 1.4x | 32.8 | 10.0 | 3.3x |
   | `u64 / 13` | 19.8 | 5.0 | 4.0x | 53.4 | 5.1 | 10.5x |
   | `u64 % 13` | 19.9 | 6.1 | 3.3x | 56.2 | 5.5 | 10.2x |
   | `i64 / 13` | 19.9 | 7.8 | 2.6x | 52.0 | 9.0 | 5.8x |
   | `i64 % 13` | 19.9 | 8.5 | 2.3x | 54.7 | 9.7 | 5.6x |
   | `u32 / 16` | 11.9 | 0.64 | 18.7x | 14.2 | 0.41 | 34.8x |
   | `u32 % 16` | 11.9 | 3.3 | 3.6x | 16.5 | 5.5 | 3.0x |
   | `i32 / 16` | 12.0 | 6.1 | 2.0x | 14.3 | 6.2 | 2.3x |
   | `i32 % 16` | 12.0 | 4.7 | 2.6x | 16.5 | 6.5 | 2.5x |
   | `u64 / 16` | 19.9 | 1.26 | 15.8x | 15.0 | 0.80 | 18.8x |
   | `u64 % 16` | 19.9 | 3.1 | 6.4x | 16.5 | 5.5 | 3.0x |
   | `i64 / 16` | 20.0 | 6.1 | 3.3x | 13.8 | 6.2 | 2.2x |
   | `i64 % 16` | 19.9 | 4.7 | 4.2x | 16.5 | 6.5 | 2.5x |
   
   </details>
   


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