adriangb opened a new pull request, #27811:
URL: https://github.com/apache/datafusion/pull/27811

   > [!NOTE]
   > Stacked on [#27807](https://github.com/apache/datafusion/pull/27807). 
Review only the last commit, `benchmarks: interleave baseline and branch 
iterations in lockstep`. The first two commits belong to #27807.
   
   ## Which issue does this PR close?
   
   - None. This is a follow-up to 
[#27807](https://github.com/apache/datafusion/pull/27807) (adaptive iteration 
loop) and [#27805](https://github.com/apache/datafusion/pull/27805) 
(`compare.py` confidence interval). Both reduce noise in the PR benchmark 
comments, as discussed in 
[#27738](https://github.com/apache/datafusion/pull/27738#issuecomment-7224080539).
   
   ## Rationale for this change
   
   Benchmark comparisons run every baseline iteration first, then every branch 
iteration. Any drift on the machine (noisy neighbors, thermal state, the 
network under `--simulate-latency`) then lands on one side only, and more 
iterations cannot remove it. The baseline and the branch are separate binaries, 
so they cannot share one process. Alternating iterations needs the two 
processes to take turns.
   
   ## What changes are included in this PR?
   
   ```text
   interleave.py              dfbench (baseline)        dfbench (branch)
        │◄── ready ─────────── Sampler.next_iteration()
        │─── run ────────────►  run query, report elapsed
        │◄── ready ─────────────────────────────────────── 
Sampler.next_iteration()
        │─── run ───────────────────────────────────────►  run query, report 
elapsed
        │   ... AB, BA, AB ... stop only at a pair boundary
        │─── stop ───────────► (both)  next query
   ```
   
   - `dfbench` gains `--lockstep-in` and `--lockstep-out` (FIFO paths). With 
them, `Sampler` asks the orchestrator before each iteration and reports each 
duration. Every runner already goes through `Sampler`, so no runner changes.
   - `benchmarks/interleave.py --baseline "<cmd>" --branch "<cmd>"` starts both 
processes and alternates single iterations in ABBA order. A query stops at a 
pair boundary once it has `--iterations` pairs and one of these holds: both 
sides together used `--max-time` seconds, the 95% CI of the median per-pair 
ratio is within `--target-precision`, or it reached `--max-iterations`. Both 
sides always have equal counts. A single iteration longer than `--max-time` 
gives `--iterations` runs per side.
   - Each process writes its own `-o` results JSON, so `compare.py` works 
unchanged.
   - `imdb::RunOpt` is boxed in the `imdb` binary, because the new options 
trigger `clippy::large_enum_variant`.
   
   ## What is the testing strategy for this PR?
   
   There are A/A runs (the same binary as both sides) of 
`sort_pushdown_inexact` with `--simulate-latency`, compared with the 
`compare.py` from #27805. The first two rows are the same test without lockstep:
   
   | Approach | Samples / side / query | Typical CI | False changes |
   |---|---|---|---|
   | Sequential, `--max-time 30` per side | ~70 | ~±0.10 | 1 / 5 |
   | ABBA passes, 6 × `--max-time 5` | ~70 | ~±0.10 | 1 / 5 |
   | Lockstep, `--max-time 30` shared | ~35 | ~±0.15 | 0 / 10 |
   
   The lockstep runs had half the samples per side, so part of the improvement 
comes from wider intervals. There is no automated test of the FIFO protocol. 
The A/A runs exercise it end to end.
   
   ## Are there any user-facing changes?
   
   New optional `dfbench` flags and a new `benchmarks/interleave.py` script. 
There are no library API changes.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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

Reply via email to