mapleFU commented on PR #55714:
URL: https://github.com/apache/arrow/pull/55714#issuecomment-7077297667

   Sure, please go ahead and finish this PR — thanks for working on it! Here 
are a few concrete suggestions to make the benchmark suite leaner and more 
accurate (Some advices are written by ai and verified by me, maybe you can just 
follow the way of arrow-rs):
   
   1. **Trim the parameter matrix (currently 80 new cases):**
        - With `dist_digits` fixed to `[0, 100000]`, `decimals = 1` and 
`decimals = 4` produce the exact same ~17-bit integer range, so sweeping both 
doubles the benchmark count without testing a different bit width.
        - Keeping a single decimal scale (e.g. `decimals = 2`) and narrowing 
`exception_percent` to `{0, 1, 10, 100}` (zero exceptions, sparse exceptions, 
moderate exceptions, and worst-case uncompressible data) covers all the 
interesting regimes while keeping CI/Conbench runtime reasonable.
   
   2. **Fix the `float` 0%-exception ULP issue, include negative values, and 
use a deterministic RNG:**
      - Regarding the `~1.2` float ratio at `0%` exceptions: ALP decodes by 
multiplying by `10^-e` rather than dividing by `10^e`. In `float32`, 
`static_cast<float>(k) /
      100.0f` differs from `static_cast<float>(k) * 0.01f` by 1 ULP for ~28% of 
values (e.g. `5.0f / 100.0f != 5.0f * 0.01f`), which forces them into 
exceptions. Using `*
      static_cast<T>(std::pow(10.0, -decimals))` ensures `exception_percent = 
0` genuinely measures the 0-exception path for both `float` and `double`.
      - Use a symmetric signed range (e.g. `[-100000, 100000]`) so negative 
values and signed FOR are exercised as well.
      - Replace `std::default_random_engine` with `std::mt19937_64` (or a 
deterministic generator) so inputs are reproducible across 
libstdc++/libc++/MSVC.
   
   3. **Keep encode and decode benchmarks consistent:**
      - Please also add `state.counters["compression_ratio"]` and 
`benchmark::DoNotOptimize(buf)` to `BM_AlpEncodingVaried` (matching 
`BM_AlpDecodingVaried` and
      `BM_DeltaEncodingByteArray` in the same file).
      - Minor formatting: add a blank line between 
`BENCHMARK(BM_AlpDecodingDouble)...` and the new comment block.
   
   For reference, `arrow-rs` also has a nice, compact ALP benchmark setup in 
https://github.com/apache/arrow-rs/blob/main/parquet/benches/alp.rs (using 
deterministic `decimal_with_exceptions` and `high_precision` fixtures.


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