sunchao commented on code in PR #7811:
URL: https://github.com/apache/datafusion-comet/pull/7811#discussion_r4806510752
##########
native/spark-expr/src/math_funcs/wide_decimal_binary_expr.rs:
##########
@@ -225,12 +311,24 @@ impl PhysicalExpr for WideDecimalBinaryExpr {
// optimization of the closure rather than the number of stores. #5309
// tracks removing the sentinel and `Cell` by writing null bits
directly.
let overflowed = Cell::new(false);
+ let check_overflow = |result: i256, raw: i256, report_scale| {
Review Comment:
@viirya I found no regression in the non-overflow cases. All 11 cases that
exercise `WideDecimalBinaryExpr` took less time after
[092eb7f](https://github.com/apache/datafusion-comet/commit/092eb7f5db4dabd4e5d8d18703174370d5446ed2)
in all six pairs. I left the inlining attributes unchanged.
I built `cargo bench --locked --bench wide_decimal --no-run` in
`native/spark-expr` at each commit with the default bench profile. I ran the
two Criterion binaries on the same pinned CPU (Xeon 6975P-C, rustc 1.100.1),
alternating which ran first. Each run took 100 samples per case. Times are
medians of six Criterion slope estimates in **µs per 8,192 rows**. The last
column is the median of the six paired time changes. Lower is faster.
| Case | af8a150 | 092eb7f | Change |
|---|---:|---:|---:|
| Add, same scale | 145.86 | 98.86 | −32.2% |
| Add, different scales | 145.98 | 98.67 | −32.3% |
| Subtract | 145.81 | 98.92 | −32.2% |
| Multiply | 246.07 | 230.99 | −5.8% |
| Multiply, 48-digit products | 240.09 | 227.04 | −5.4% |
| Add, no overflow | 145.23 | 98.44 | −32.0% |
| Add, no overflow with nulls | 111.74 | 89.04 | −20.2% |
| Add, ANSI, no overflow | 145.07 | 98.41 | −31.9% |
| Add, overflow on last row | 152.91 | 106.51 | −30.4% |
| Add, overflow every 17 rows | 153.22 | 106.63 | −30.3% |
| Add, overflow every other row | 154.28 | 111.24 | −27.9% |
The benchmark's five `old/` cases use the unchanged cast chain. Their median
paired changes ranged from −0.55% to +0.76%. These measurements cover the
regular nonnegative-scale kernel on this runner. They don't measure the BigInt
path or isolate which compiler optimization produced the difference.
[Full results, including controls and individual
pairs](https://github.com/sunchao/arrow-datafusion-comet/actions/runs/47422541585)
· [Raw Criterion
samples](https://github.com/sunchao/arrow-datafusion-comet/actions/runs/47422541585/artifacts/15893956060)
· [Runner
script](https://github.com/sunchao/arrow-datafusion-comet/blob/9897fb30b1aad6351df5e3aae4815b0f15719ec9/.github/workflows/measure-7811.yml)
The [Rust
tests](https://github.com/sunchao/arrow-datafusion-comet/actions/runs/47411396433/job/145318143927)
and [Spark 4.1 expression
suite](https://github.com/sunchao/arrow-datafusion-comet/actions/runs/47411396433/job/145331701670)
passed. [Fork CI passed on the same
commit](https://github.com/sunchao/arrow-datafusion-comet/actions/runs/47411396433/attempts/3)
after retrying the jobs that hit Maven Central HTTP 429.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]