Baymine commented on PR #66391:
URL: https://github.com/apache/doris/pull/66391#issuecomment-5395114243
# Wide-Integer 256-bit Division Fast-Path Benchmark
## Environment
- **CPU**: 128 vCPUs @ 3.5 GHz (L1d 48 KiB, L2 1280 KiB, L3 49 MB × 2)
- **Compiler**: Clang++, `-O2`, Release build
- **Benchmark**: Google Benchmark with `--benchmark_min_time=2s
--benchmark_repetitions=3 --benchmark_report_aggregates_only=true`
- **Wall-clock stability**: Each case ran ≥ 6 seconds total (2 s per rep × 3
reps)
- **Batch**: 65536 random operand pairs per state-iteration (L2-resident,
amortizes cache effects)
## Results — `operator/` (Division)
Per-element time in nanoseconds (median time ÷ 65536 = ns / div):
| Case | Legacy Generic | Default (fast path) |
Speedup | Fast path hit |
|---------------------------------|---------------:|--------------------:|---------:|----------------------------------------|
| `BothFit128` (n,d < 2^128) | 27.4 ns | **11.7 ns** |
**2.34×** | Path 1 — single `__int128` divide |
| `SingleLimb` (d = 10^k) | 2128 ns | **13.7 ns** |
**155×** | Path 2 — schoolbook limb-by-limb |
| `TwoLimbKnuth` (2^64 ≤ d < 2^128) | 1559 ns | **154.9 ns** |
**10.1×** | Path 3 — Knuth Algorithm D (base 2^32) |
| `TrulyWide` (d ≥ 2^128) | 881 ns | **857 ns** |
**1.03×** ✓ | No fast path (unchanged code path) |
## Results — `operator%` (Modulo)
| Case | Legacy Generic | Default (fast path) |
Speedup |
|---------------------------------|---------------:|--------------------:|---------:|
| `BothFit128` | 28.0 ns | **14.2 ns** |
**1.97×** |
| `SingleLimb` (d = 10^k) | 2111 ns | **15.1 ns** |
**140×** |
| `TwoLimbKnuth` | 1563 ns | **156.5 ns** |
**10.0×** |
| `TrulyWide` | 876 ns | **860 ns** |
**1.02×** |
## Comparison with Short-Burst Measurement
To validate these numbers aren't an artifact of the larger batch, here are
the same cases run in "short-burst" mode (2000 iterations of 1 div each, ~30 µs
total per case):
| Case | Short-burst speedup | 6-second speedup |
|--------------------------|--------------------:|-----------------:|
| SingleLimb Div | 110× | **155×** |
| TwoLimbKnuth Div | 7.8× | **10.1×** |
| BothFit128 Div | 2.4× | **2.34×** |
| TrulyWide Div | 1.05× | **1.03×** |
--
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]