tools: improve alignment for v repeat "program" "program_that_is_over_10x_faster"

This commit is contained in:
Delyan Angelov 2025-07-24 15:46:54 +03:00
parent 267d8262b3
commit 05479f3bd9
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED

View File

@ -135,11 +135,11 @@ fn bold(s string) string {
} }
fn (a Aints) str() string { fn (a Aints) str() string {
avg := bold('${a.average / 1000:5.1f}ms') avg := bold('${a.average / 1000:6.1f}ms')
tdev := c(tred, '${a.stddev / 1000:5.1f}ms') tdev := c(tred, '${a.stddev / 1000:6.1f}ms')
baseline := '${avg} ± σ: ${tdev},' baseline := '${avg} ± σ: ${tdev},'
tmin := c(tbcyan, '${f64(a.imin) / 1000:5.1f}ms') tmin := c(tbcyan, '${f64(a.imin) / 1000:6.1f}ms')
tmax := c(tbblue, '${f64(a.imax) / 1000:5.1f}ms') tmax := c(tbblue, '${f64(a.imax) / 1000:6.1f}ms')
return '${baseline:-46s} ${tmin}${tmax}' return '${baseline:-46s} ${tmin}${tmax}'
} }
@ -345,7 +345,7 @@ fn (mut context Context) show_diff_summary() {
} }
mut comparison := '' mut comparison := ''
if r.atiming.average != base { if r.atiming.average != base {
comparison = '${cpercent:+6.1f}%' comparison = '${cpercent:+8.1f}%'
} }
mut tcomparison := ' base ' mut tcomparison := ' base '
if r.atiming.average != base { if r.atiming.average != base {
@ -381,12 +381,12 @@ fn readable_comparison(tcurrent f64, tbase f64, cpercent f64) string {
if !is_same { if !is_same {
label = c(tgreen, 'faster') label = c(tgreen, 'faster')
} }
return '${tbase / tcurrent:4.2f}x ${label}' return '${tbase / tcurrent:6.2f}x ${label}'
} else { } else {
if !is_same { if !is_same {
label = c(tcyan, 'slower') label = c(tcyan, 'slower')
} }
return '${tcurrent / tbase:4.2f}x ${label}' return '${tcurrent / tbase:6.2f}x ${label}'
} }
} }