You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "mbutrovich (via GitHub)" <gi...@apache.org> on 2026/10/12 17:53:21 UTC

[PR] perf(arrow-arith): divide once per row in `multiply_fixed_point` [arrow-rs]

mbutrovich opened a new pull request, #11526:
URL: https://github.com/apache/arrow-rs/pull/11526

   # Which issue does this PR close?
   
   - Closes #11453.
   - Part of #11421.
   
   # Rationale for this change
   
   See #11453.
   
   # What changes are included in this PR?
   
   `divide_and_round` takes the divisor and returns a closure that computes `half` and `half_neg` once and divides each row with `i256::wrapping_div_rem` from #11425. `multiply_fixed_point` and `multiply_fixed_point_checked` build the closure before calling `binary` and `try_binary`. The results don't change.
   
   # Are these changes tested?
   
   `test_decimal_multiply_fixed_point_rounding` in `arrow-arith/src/arithmetic.rs` covers rounding of negative products, ties and both null paths, which the existing tests of `multiply_fixed_point` and `multiply_fixed_point_checked` don't reach. It passes on `main` and with this change.
   
   On an Apple M5 Max with rustc 1.99.0, the `decimal128_multiply_fixed_point` benchmark from #11427 gave, in us per 1024 values:
   
   | Case | `main` | This PR |
   |---|---|---|
   | 15 digits, scale 10 to scale 6 | 43.6 | 19.1 |
   | 24 digits, scale 10 to scale 6 | 61.1 | 29.4 |
   | 21 digits, scale 20 to scale 6 | 53.0 | 23.5 |
   
   I'll run the benchmark bot on this PR for arm64 and x86_64 numbers.
   
   # Are there any significant user-facing changes?
   
   No.
   
   ## AI Disclosure
   
   I wrote this PR with help from Claude but understand and support the core approach, implementation, and test coverage.
   


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] perf(arrow-arith): divide once per row in `multiply_fixed_point` [arrow-rs]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #11526:
URL: https://github.com/apache/arrow-rs/pull/11526#issuecomment-6155082843

   merge queue seems stuck. Rekicking


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] perf(arrow-arith): divide once per row in `multiply_fixed_point` [arrow-rs]

Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #11526:
URL: https://github.com/apache/arrow-rs/pull/11526#issuecomment-6129729047

   🤖 Benchmark completed (GKE) | [trigger](https://github.com/apache/arrow-rs/pull/11526#issuecomment-6129646941)
   
   **Target:** decimal&#95;division
   
   Comparing multiply-fixed-point-div-rem (865927fb07a3b524ce7707f48c07ecd6990de06d) to 01b1275 (merge-base) [diff](https://github.com/apache/arrow-rs/compare/01b1275aab90c033da3f64f5edbfb4f061606cae..865927fb07a3b524ce7707f48c07ecd6990de06d)
   
   <details><summary>Run configuration</summary>
   
   ```yaml
   run benchmark decimal_division
   env:
     BENCH_FILTER: decimal128_multiply_fixed_point
   shards: 1
   
   ```
   
   </details>
   
   <details><summary>Details</summary>
   
   ```
   group                                                            base                                   changed
   -----                                                            ----                                   -------
   decimal128_multiply_fixed_point/15_digits_scale_10_to_scale_6    2.46     73.2±0.04µs 13.3 MElem/sec    1.00     29.8±0.41µs 32.8 MElem/sec
   decimal128_multiply_fixed_point/21_digits_scale_20_to_scale_6    2.38     96.2±0.20µs 10.2 MElem/sec    1.00     40.4±0.29µs 24.1 MElem/sec
   decimal128_multiply_fixed_point/24_digits_scale_10_to_scale_6    2.32    104.6±0.09µs  9.3 MElem/sec    1.00     45.0±0.57µs 21.7 MElem/sec
   
   ```
   
   </details>
   
   <details><summary>Per-runner information</summary>
   
   <details><summary>decimal&#95;division — shard 1/1</summary>
   
   **Node:** gk3-benchmark-cluster-nap-1xf30ion-5384a9f0-94c4
   
   **Instance:** c4a-highmem-16 (12 vCPU / 65 GiB)
   
   **uname:**
   
   ```text
   Linux bench-c6129646941-3344-bk8mm 6.12.94+ #1 SMP Fri Aug 21 08:00:16 UTC 2026 aarch64 GNU/Linux
   ```
   
   **BENCH_COMMAND:**
   
   ```sh
   cargo bench --features=arrow,async,test_common,experimental,object_store --bench decimal_division
   ```
   
   <details><summary>CPU Details (lscpu)</summary>
   
   ```text
   Architecture:                            aarch64
   CPU op-mode(s):                          64-bit
   Byte Order:                              Little Endian
   CPU(s):                                  16
   On-line CPU(s) list:                     0-15
   Vendor ID:                               ARM
   Model name:                              Neoverse-V2
   Model:                                   1
   Thread(s) per core:                      1
   Core(s) per cluster:                     16
   Socket(s):                               -
   Cluster(s):                              1
   Stepping:                                r0p1
   BogoMIPS:                                2000.00
   Flags:                                   fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh rng bti
   L1d cache:                               1 MiB (16 instances)
   L1i cache:                               1 MiB (16 instances)
   L2 cache:                                32 MiB (16 instances)
   L3 cache:                                80 MiB (1 instance)
   NUMA node(s):                            1
   NUMA node0 CPU(s):                       0-15
   Vulnerability Gather data sampling:      Not affected
   Vulnerability Indirect target selection: Not affected
   Vulnerability Itlb multihit:             Not affected
   Vulnerability L1tf:                      Not affected
   Vulnerability Mds:                       Not affected
   Vulnerability Meltdown:                  Not affected
   Vulnerability Mmio stale data:           Not affected
   Vulnerability Reg file data sampling:    Not affected
   Vulnerability Retbleed:                  Not affected
   Vulnerability Spec rstack overflow:      Not affected
   Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
   Vulnerability Spectre v1:                Mitigation; __user pointer sanitization
   Vulnerability Spectre v2:                Mitigation; CSV2, BHB
   Vulnerability Srbds:                     Not affected
   Vulnerability Tsa:                       Not affected
   Vulnerability Tsx async abort:           Not affected
   Vulnerability Vmscape:                   Not affected
   ```
   
   </details>
   
   <details><summary>Resource Usage</summary>
   
   **base (merge-base)**
   | Metric | Value |
   |--------|-------|
   | Wall time | 30.0s |
   | Peak memory | 12.2 MiB |
   | Avg memory | 9.1 MiB |
   | CPU user | 27.8s |
   | CPU sys | 0.0s |
   | Peak spill | 0 B |
   
   **branch**
   | Metric | Value |
   |--------|-------|
   | Wall time | 35.0s |
   | Peak memory | 12.2 MiB |
   | Avg memory | 8.9 MiB |
   | CPU user | 30.0s |
   | CPU sys | 0.0s |
   | Peak spill | 0 B |
   
   
   </details>
   
   </details>
   
   </details>
   
   ---
   [File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner
   
   <!-- benchmark-request:6129646941:finish:b8a60e92df7817433c4ba735166c072c -->


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] perf(arrow-arith): divide once per row in `multiply_fixed_point` [arrow-rs]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #11526:
URL: https://github.com/apache/arrow-rs/pull/11526


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] perf(arrow-arith): divide once per row in `multiply_fixed_point` [arrow-rs]

Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #11526:
URL: https://github.com/apache/arrow-rs/pull/11526#issuecomment-6129650453

   🤖 Benchmark starting (GKE) | [trigger](https://github.com/apache/arrow-rs/pull/11526#issuecomment-6129649050)
   
   **Target:** decimal&#95;division
   
   **Sharding factor: 1** (1 workers).
   
   Comparing multiply-fixed-point-div-rem (865927fb07a3b524ce7707f48c07ecd6990de06d) to 01b1275 (merge-base) [diff](https://github.com/apache/arrow-rs/compare/01b1275aab90c033da3f64f5edbfb4f061606cae..865927fb07a3b524ce7707f48c07ecd6990de06d)
   
   <details><summary>Run configuration</summary>
   
   ```yaml
   run benchmark decimal_division
   env:
     BENCH_FILTER: decimal128_multiply_fixed_point
   resources:
     arch: amd64
   shards: 1
   
   ```
   
   </details>
   
   Results will be posted when all workers finish.
   
   ---
   [File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner
   
   <!-- benchmark-request:6129649050:start:dc105dbe15975d8c22aa19b556aff29a -->


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] perf(arrow-arith): divide once per row in `multiply_fixed_point` [arrow-rs]

Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #11526:
URL: https://github.com/apache/arrow-rs/pull/11526#issuecomment-6129647835

   🤖 Benchmark starting (GKE) | [trigger](https://github.com/apache/arrow-rs/pull/11526#issuecomment-6129646941)
   
   **Target:** decimal&#95;division
   
   **Sharding factor: 1** (1 workers).
   
   Comparing multiply-fixed-point-div-rem (865927fb07a3b524ce7707f48c07ecd6990de06d) to 01b1275 (merge-base) [diff](https://github.com/apache/arrow-rs/compare/01b1275aab90c033da3f64f5edbfb4f061606cae..865927fb07a3b524ce7707f48c07ecd6990de06d)
   
   <details><summary>Run configuration</summary>
   
   ```yaml
   run benchmark decimal_division
   env:
     BENCH_FILTER: decimal128_multiply_fixed_point
   shards: 1
   
   ```
   
   </details>
   
   Results will be posted when all workers finish.
   
   ---
   [File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner
   
   <!-- benchmark-request:6129646941:start:adfeee838e608cd1d35d428ca746ed5a -->


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] perf(arrow-arith): divide once per row in `multiply_fixed_point` [arrow-rs]

Posted by "mbutrovich (via GitHub)" <gi...@apache.org>.
mbutrovich commented on PR #11526:
URL: https://github.com/apache/arrow-rs/pull/11526#issuecomment-6129649050

   run benchmark decimal_division
   ```
   env:
     BENCH_FILTER: decimal128_multiply_fixed_point
   resources:
     arch: amd64
   ```


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] perf(arrow-arith): divide once per row in `multiply_fixed_point` [arrow-rs]

Posted by "mbutrovich (via GitHub)" <gi...@apache.org>.
mbutrovich commented on PR #11526:
URL: https://github.com/apache/arrow-rs/pull/11526#issuecomment-6129646941

   run benchmark decimal_division
   ```
   env:
     BENCH_FILTER: decimal128_multiply_fixed_point
   ```


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] perf(arrow-arith): divide once per row in `multiply_fixed_point` [arrow-rs]

Posted by "adriangbot (via GitHub)" <gi...@apache.org>.
adriangbot commented on PR #11526:
URL: https://github.com/apache/arrow-rs/pull/11526#issuecomment-6129725592

   🤖 Benchmark completed (GKE) | [trigger](https://github.com/apache/arrow-rs/pull/11526#issuecomment-6129649050)
   
   **Target:** decimal&#95;division
   
   Comparing multiply-fixed-point-div-rem (865927fb07a3b524ce7707f48c07ecd6990de06d) to 01b1275 (merge-base) [diff](https://github.com/apache/arrow-rs/compare/01b1275aab90c033da3f64f5edbfb4f061606cae..865927fb07a3b524ce7707f48c07ecd6990de06d)
   
   <details><summary>Run configuration</summary>
   
   ```yaml
   run benchmark decimal_division
   env:
     BENCH_FILTER: decimal128_multiply_fixed_point
   resources:
     arch: amd64
   shards: 1
   
   ```
   
   </details>
   
   <details><summary>Details</summary>
   
   ```
   group                                                            base                                   changed
   -----                                                            ----                                   -------
   decimal128_multiply_fixed_point/15_digits_scale_10_to_scale_6    2.76     45.2±0.91µs 21.6 MElem/sec    1.00     16.4±0.22µs 59.6 MElem/sec
   decimal128_multiply_fixed_point/21_digits_scale_20_to_scale_6    2.27     84.1±0.83µs 11.6 MElem/sec    1.00     37.0±0.34µs 26.4 MElem/sec
   decimal128_multiply_fixed_point/24_digits_scale_10_to_scale_6    2.92     44.7±0.46µs 21.9 MElem/sec    1.00     15.3±0.18µs 63.8 MElem/sec
   
   ```
   
   </details>
   
   <details><summary>Per-runner information</summary>
   
   <details><summary>decimal&#95;division — shard 1/1</summary>
   
   **Node:** gk3-benchmark-cluster-nap-yb7qdwgp-50fa391f-xnqs
   
   **Instance:** c4-highmem-16 (12 vCPU / 65 GiB)
   
   **uname:**
   
   ```text
   Linux bench-c6129649050-3345-t85gm 6.12.94+ #1 SMP Fri Aug 21 07:56:42 UTC 2026 x86_64 GNU/Linux
   ```
   
   **BENCH_COMMAND:**
   
   ```sh
   cargo bench --features=arrow,async,test_common,experimental,object_store --bench decimal_division
   ```
   
   <details><summary>CPU Details (lscpu)</summary>
   
   ```text
   Architecture:                            x86_64
   CPU op-mode(s):                          32-bit, 64-bit
   Address sizes:                           52 bits physical, 57 bits virtual
   Byte Order:                              Little Endian
   CPU(s):                                  16
   On-line CPU(s) list:                     0-15
   Vendor ID:                               GenuineIntel
   Model name:                              INTEL(R) XEON(R) PLATINUM 8581C CPU @ 2.30GHz
   CPU family:                              6
   Model:                                   207
   Thread(s) per core:                      2
   Core(s) per socket:                      8
   Socket(s):                               1
   Stepping:                                2
   BogoMIPS:                                4600.00
   Flags:                                   fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch ssbd ibrs ibpb stibp ibrs_enhanced fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves avx_vnni avx512_bf16 wbnoinvd arat avx512vbmi umip avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq rdpid cldemote movdiri movdir64b fsrm md_clear serialize tsxldtrk amx_bf16 avx512_fp16 amx_tile amx_int8 arch_capabilities
   Hypervisor vendor:                       KVM
   Virtualization type:                     full
   L1d cache:                               384 KiB (8 instances)
   L1i cache:                               256 KiB (8 instances)
   L2 cache:                                16 MiB (8 instances)
   L3 cache:                                260 MiB (1 instance)
   NUMA node(s):                            1
   NUMA node0 CPU(s):                       0-15
   Vulnerability Gather data sampling:      Not affected
   Vulnerability Indirect target selection: Not affected
   Vulnerability Itlb multihit:             Not affected
   Vulnerability L1tf:                      Not affected
   Vulnerability Mds:                       Not affected
   Vulnerability Meltdown:                  Not affected
   Vulnerability Mmio stale data:           Not affected
   Vulnerability Reg file data sampling:    Not affected
   Vulnerability Retbleed:                  Not affected
   Vulnerability Spec rstack overflow:      Not affected
   Vulnerability Spec store bypass:         Mitigation; Speculative Store Bypass disabled via prctl
   Vulnerability Spectre v1:                Mitigation; usercopy/swapgs barriers and __user pointer sanitization
   Vulnerability Spectre v2:                Mitigation; Enhanced / Automatic IBRS; IBPB conditional; PBRSB-eIBRS SW sequence; BHI BHI_DIS_S
   Vulnerability Srbds:                     Not affected
   Vulnerability Tsa:                       Not affected
   Vulnerability Tsx async abort:           Not affected
   Vulnerability Vmscape:                   Not affected
   ```
   
   </details>
   
   <details><summary>Resource Usage</summary>
   
   **base (merge-base)**
   | Metric | Value |
   |--------|-------|
   | Wall time | 35.0s |
   | Peak memory | 14.2 MiB |
   | Avg memory | 10.7 MiB |
   | CPU user | 33.0s |
   | CPU sys | 0.0s |
   | Peak spill | 0 B |
   
   **branch**
   | Metric | Value |
   |--------|-------|
   | Wall time | 30.0s |
   | Peak memory | 14.0 MiB |
   | Avg memory | 10.7 MiB |
   | CPU user | 28.0s |
   | CPU sys | 0.0s |
   | Peak spill | 0 B |
   
   
   </details>
   
   </details>
   
   </details>
   
   ---
   [File an issue](https://github.com/adriangb/datafusion-benchmarking/issues) against this benchmark runner
   
   <!-- benchmark-request:6129649050:finish:f9cd52535befe130bd2a63df994e1546 -->


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org