Problem
In format_table_with_frames, the padding loop at lines 411-417 pads all entries (including companion-merged functions) with zeros so late-appearing functions have values for earlier frames:
let total_frames = frame_data.frames.len();
for e in &mut entries {
while e.per_frame_self_ns.len() < total_frames {
e.per_frame_self_ns.push(0);
}
}
This is functionally harmless because the is_companion guard at line 441 prevents the padded vector from being used in percentile calculation. However, the zero-fill skip at lines 377-385 already excludes companion functions, so this padding loop is inconsistent -- it allocates zeros that are never read.
Suggested fix
Add the same companion guard to the padding loop:
for e in &mut entries {
if !e.is_companion {
while e.per_frame_self_ns.len() < total_frames {
e.per_frame_self_ns.push(0);
}
}
}
Context
Discovered during code review of PR #104.
Problem
In
format_table_with_frames, the padding loop at lines 411-417 pads all entries (including companion-merged functions) with zeros so late-appearing functions have values for earlier frames:This is functionally harmless because the
is_companionguard at line 441 prevents the padded vector from being used in percentile calculation. However, the zero-fill skip at lines 377-385 already excludes companion functions, so this padding loop is inconsistent -- it allocates zeros that are never read.Suggested fix
Add the same companion guard to the padding loop:
Context
Discovered during code review of PR #104.