@@ -321,13 +321,28 @@ pub(crate) fn calc_stats(count: usize) -> std::io::Result<()> {
321321 }
322322 }
323323
324- info ! ( "worst ratios:" ) ;
325- for ( i, ( ratio, name, _count, len, dlen, abs) ) in pairs. iter ( ) . rev ( ) . take ( count) . enumerate ( ) {
324+ let iwidth = count. ilog10 ( ) as usize + 1 ;
325+ let cwidth = pairs
326+ . iter ( )
327+ . map ( |( _r, _n, c, _l, _dl, _abs) | c)
328+ . max ( )
329+ . cloned ( )
330+ . unwrap_or_default ( )
331+ . ilog10 ( ) as usize
332+ + 1 ;
333+
334+ info ! ( "worst ratios with 1+ hits:" ) ;
335+ for ( i, ( ratio, name, ucount, len, dlen, abs) ) in pairs
336+ . iter ( )
337+ . rev ( )
338+ . filter ( |( _r, _n, c, _l, _dl, _abs) | * c > 1 )
339+ . take ( count)
340+ . enumerate ( )
341+ {
326342 info ! (
327- "{}. {:.2}% {}: {} {} each update " ,
343+ "{:>iwidth$ }. {:.2}% {name }: {} {} in {ucount:>cwidth$} updates " ,
328344 i + 1 ,
329345 ratio * 100. ,
330- name,
331346 ByteSize :: b( * abs) ,
332347 if dlen < len { "saved" } else { "wasted" }
333348 )
@@ -336,10 +351,9 @@ pub(crate) fn calc_stats(count: usize) -> std::io::Result<()> {
336351 info ! ( "top ratios:" ) ;
337352 for ( i, ( ratio, name, _count, len, dlen, abs) ) in pairs. iter ( ) . take ( count) . enumerate ( ) {
338353 info ! (
339- "{}. {:.2}% {}: {} {} each update" ,
354+ "{:>iwidth$ }. {:.2}% {name }: {} {} each update" ,
340355 i + 1 ,
341356 ratio * 100. ,
342- name,
343357 ByteSize :: b( * abs) ,
344358 if dlen < len { "saved" } else { "wasted" }
345359 )
@@ -348,13 +362,13 @@ pub(crate) fn calc_stats(count: usize) -> std::io::Result<()> {
348362 info ! ( "top size saves" ) ;
349363 for ( i, ( ratio, name, count, len, dlen, abs) ) in pairs. iter ( ) . rev ( ) . take ( count) . enumerate ( ) {
350364 info ! (
351- "{}. {:.2}% {}: { } {} in {} updates " ,
365+ "{:>iwidth$ }. {} {} in {:>cwidth$ } {name} {} ({:.2}%) " ,
352366 i + 1 ,
353- ratio * 100. ,
354- name,
355367 ByteSize :: b( * abs * count) ,
356368 if dlen < len { "saved" } else { "wasted" } ,
357- count
369+ count,
370+ if * count == 1 { "update" } else { "updates" } ,
371+ ratio * 100. ,
358372 )
359373 }
360374
0 commit comments