Repository navigation
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
There was a problem hiding this comment.
AI-generated review (Claude Opus 5.5). Not a maintainer decision.
No blocking problems found (not certain).
For an even number of samples, summarize_ms now takes the median as the midpoint of the two middle sorted values. Odd and empty inputs behave as before.
- apps/deckcraft-cli/src/main.rs:173-175: lower uses index (len-1)/2 and upper uses index len/2. For odd lengths both are the same element, so midpoint returns that element unchanged. For empty input both fall back to 0.0.
- apps/deckcraft-cli/src/main.rs:765: the new assertion sorts [21, 4, 15, 7] to [4, 7, 15, 21] and expects median 11 and maximum 21, which matches the new logic.
- f64::midpoint needs Rust 1.85 or later. If the workspace declares a lower rust-version, that value needs raising.
Claims checked:
- verified: For even run counts the reported median is the midpoint of the two middle timings. (apps/deckcraft-cli/src/main.rs:173-175 takes ms[(len-1)/2] and ms[len/2] after sort_by(f64::total_cmp) and returns lower.midpoint(upper). The test at apps/deckcraft-cli/src/main.rs:765 expects 11.0 for [4,7,15,…
- verified: The existing sort and maximum calculation are unchanged. (apps/deckcraft-cli/src/main.rs:172 still calls ms.sort_by(f64::total_cmp), and the maximum is still ms.last().copied().unwrap_or(0.0) at apps/deckcraft-cli/src/main.rs:175.)
- verified: Odd and empty sample sets behave as before. (apps/deckcraft-cli/src/main.rs:173-174: for odd len, (len-1)/2 == len/2, so both values are the same element. For empty input both get() calls return None and fall back to 0.0. The test at apps/deckcraft-cli/src/main.rs:766 still expects (0.0, 0.0).)
Reviewed at 8fa3cca.
Recommendation: merge, after a maintainer's decision.
deckcraft-cli bench --runs 10now reports the midpoint of the two middle timings as the median.Follow-up to #1545. The benchmark picked the upper middle sample for even run counts, so the value labeled median was too high. Keep the existing sort and maximum calculation and use
f64::midpointfor the median.The regression checks the median and maximum of four unsorted measurements. A focused Rust probe reproduced the wrong median and passed four checks after the change. It also covered odd, empty, and equal large finite measurements. Full CLI tests were left to CI.
Summary by CodeRabbit