小文件(total ≤ 35 行)时,bench_single_frame 中 tail 位置 total.saturating_sub(35) 为 0,与 head 完全重叠,产生标记不同但数据相同的 benchmark 结果。
bench_single_frame
tail
total.saturating_sub(35)
head
此外 total 在 36~104 行时,head/tail/middle 帧之间存在大量重叠区域,total=70 时 middle 与 tail 完全重叠。
total
total=70
crates/bench/src/suites/render.rs 硬编码三个位置:
crates/bench/src/suites/render.rs
let positions = [ ("head", 0), ("middle", total / 2), ("tail", total.saturating_sub(35)), ];
middle = total/2 在小文件时偏向 tail;阈值仅检查 total > 0,未验证帧间不重叠。
middle = total/2
total > 0
FRAME_LINES = 35
suites/mod.rs
select_frame_positions(total)
total < 3 * FRAME_LINES
total >= 3 * FRAME_LINES
bench_reverse_scan
total <= FRAME_LINES
Fixes in PR #46 (fix/m23-single-frame-tail-overlap)
fix/m23-single-frame-tail-overlap
crates/bench/src/suites/mod.rs
FRAME_LINES
select_frame_positions()
crates/bench/src/suites/jump.rs
No dependencies set.
The note is not visible to the blocked user.
问题
小文件(total ≤ 35 行)时,
bench_single_frame中tail位置total.saturating_sub(35)为 0,与head完全重叠,产生标记不同但数据相同的 benchmark 结果。此外
total在 36~104 行时,head/tail/middle 帧之间存在大量重叠区域,total=70时 middle 与 tail 完全重叠。根因
crates/bench/src/suites/render.rs硬编码三个位置:middle = total/2在小文件时偏向 tail;阈值仅检查total > 0,未验证帧间不重叠。修复
FRAME_LINES = 35至suites/mod.rsselect_frame_positions(total)helper:total < 3 * FRAME_LINES时只返回 headtotal >= 3 * FRAME_LINES时返回三帧,middle 居中于 head-end 与 tail-start 之间bench_reverse_scan在total <= FRAME_LINES时返回空结果PR
Fixes in PR #46 (
fix/m23-single-frame-tail-overlap)变更文件
crates/bench/src/suites/mod.rsFRAME_LINEScrates/bench/src/suites/render.rsselect_frame_positions()helper, 重写bench_single_frame, +9 testscrates/bench/src/suites/jump.rsbench_reverse_scan小文件保护