Skip to content

Commit ea6ce98

Browse files
committed
fix(bench): show statistics note only in verbose mode, restore progress bar in default mode
Fixed two issues with the output modes: 1. Statistics methodology section now only appears in verbose mode 2. Progress bar now shows in both default and verbose modes Changes: - Moved print_statistics_explanation() call inside verbose check - Moved print_progress_bar() outside verbose check to always display - Moved cursor clearing outside verbose check for cleaner output Default mode now shows: - Header - Progress bar (during execution) - Summary table - Completion message Verbose mode shows: - Header - Progress bar (during execution) - Individual template results with detailed statistics - Statistics methodology section - Summary table - Completion message
1 parent 8ab28d2 commit ea6ce98

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

src/bin/bench_throughput.rs

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -864,32 +864,29 @@ fn main() {
864864
let total_templates = templates.len();
865865

866866
for (idx, (template_name, template_str)) in templates.iter().enumerate() {
867-
if verbose {
868-
print_progress_bar(idx + 1, total_templates, template_name);
869-
}
867+
// Always show progress bar
868+
print_progress_bar(idx + 1, total_templates, template_name);
870869

871870
match benchmark_template(template_name, template_str, &sizes, iterations) {
872871
Ok(results) => {
872+
let mut stdout = io::stdout();
873+
let _ = execute!(
874+
stdout,
875+
cursor::MoveToColumn(0),
876+
Clear(ClearType::CurrentLine)
877+
);
873878
if verbose {
874-
let mut stdout = io::stdout();
875-
let _ = execute!(
876-
stdout,
877-
cursor::MoveToColumn(0),
878-
Clear(ClearType::CurrentLine)
879-
);
880879
print_template_results(template_name, &results);
881880
}
882881
all_results.push((*template_name, results));
883882
}
884883
Err(e) => {
885-
if verbose {
886-
let mut stdout = io::stdout();
887-
let _ = execute!(
888-
stdout,
889-
cursor::MoveToColumn(0),
890-
Clear(ClearType::CurrentLine)
891-
);
892-
}
884+
let mut stdout = io::stdout();
885+
let _ = execute!(
886+
stdout,
887+
cursor::MoveToColumn(0),
888+
Clear(ClearType::CurrentLine)
889+
);
893890
print_error(&format!("Failed to benchmark '{}': {}", template_name, e));
894891
}
895892
}
@@ -902,8 +899,12 @@ fn main() {
902899
iterations
903900
};
904901

905-
// Always show statistics explanation and summary
906-
print_statistics_explanation(sample_count);
902+
// In verbose mode, show statistics explanation before summary
903+
if verbose {
904+
print_statistics_explanation(sample_count);
905+
}
906+
907+
// Always show summary
907908
print_summary(&all_results);
908909

909910
if format == "json"

0 commit comments

Comments
 (0)