Update how exec/sec is displayed (#2524)

- Only display 1 digit after . for value above 1k
- Only display 2 digits after . for value above 1m

3.254k exec/sec becomes => 3.2k exec/sec
3.254M exec/sec becomes => 3.25M exec/sec
This commit is contained in:
20urc3 2024-09-13 21:03:18 +02:00 committed by GitHub
parent 8ccff4b77f
commit 71ed5c7227
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -318,8 +318,11 @@ fn prettify_float(value: f64) -> String {
value => (value, ""),
};
match value {
value if value >= 1000000.0 => {
format!("{value:.2}{suffix}")
}
value if value >= 1000.0 => {
format!("{value}{suffix}")
format!("{value:.1}{suffix}")
}
value if value >= 100.0 => {
format!("{value:.1}{suffix}")