Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions crates/moonbuild/src/benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ fn auto_select_unit(us: f64) -> String {
format!("{us:>6.2} µs")
} else if us < 1e6 {
format!("{:>6.2} ms", us / 1e3)
} else if us < 1e9 {
} else if us < 6e7 {
format!("{:>6.2} s", us / 1e6)
} else {
format!("{:>6.2} min", us / 6e10)
format!("{:>6.2} min", us / 6e7)
}
}

Expand Down Expand Up @@ -98,3 +98,13 @@ pub fn render_batch_bench_summary(msg: &str) {
}
}
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn auto_select_unit_minutes() {
assert_eq!(auto_select_unit(60_000_001.0), " 1.00 min")
}
Comment on lines +108 to +109
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great if you could add the other regression that you mentioned

}
Loading