@@ -344,6 +344,10 @@ function Base.show(io::IO, ::MIME"text/plain", t::Trial)
344
344
print (io, " BenchmarkTools.Trial: " , length (t), " sample" , if length (t) > 1 " s" else " " end ,
345
345
" with " , t. params. evals, " evaluation" , if t. params. evals > 1 " s" else " " end ," .\n " )
346
346
347
+ perm = sortperm (t. times)
348
+ times = t. times[perm]
349
+ gctimes = t. gctimes[perm]
350
+
347
351
if length (t) > 1
348
352
med = median (t)
349
353
avg = mean (t)
@@ -353,16 +357,16 @@ function Base.show(io::IO, ::MIME"text/plain", t::Trial)
353
357
354
358
medtime, medgc = prettytime (time (med)), prettypercent (gcratio (med))
355
359
avgtime, avggc = prettytime (time (avg)), prettypercent (gcratio (avg))
356
- stdtime, stdgc = prettytime (time (std)), prettypercent (Statistics. std (t . gctimes ./ t . times))
360
+ stdtime, stdgc = prettytime (time (std)), prettypercent (Statistics. std (gctimes ./ times))
357
361
mintime, mingc = prettytime (time (min)), prettypercent (gcratio (min))
358
362
maxtime, maxgc = prettytime (time (max)), prettypercent (gcratio (max))
359
363
360
364
memorystr = string (prettymemory (memory (min)))
361
365
allocsstr = string (allocs (min))
362
366
elseif length (t) == 1
363
367
print (io, pad, " Single result which took " )
364
- printstyled (io, prettytime (t . times[1 ]); color= :blue )
365
- print (io, " (" , prettypercent (t . gctimes[1 ]/ t . times[1 ]), " GC) " )
368
+ printstyled (io, prettytime (times[1 ]); color= :blue )
369
+ print (io, " (" , prettypercent (gctimes[1 ]/ times[1 ]), " GC) " )
366
370
print (io, " to evaluate,\n " )
367
371
print (io, pad, " with a memory estimate of " )
368
372
printstyled (io, prettymemory (t. memory[1 ]); color= :yellow )
@@ -435,11 +439,11 @@ function Base.show(io::IO, ::MIME"text/plain", t::Trial)
435
439
histheight = 2
436
440
histwidth = 42 + lmaxtimewidth + rmaxtimewidth
437
441
438
- histtimes = t . times[1 : round (Int, histquantile* end )]
442
+ histtimes = times[1 : round (Int, histquantile* end )]
439
443
bins, logbins = bindata (histtimes, histwidth - 1 ), false
440
- append! (bins, [1 , floor ((1 - histquantile) * length (t . times))])
444
+ append! (bins, [1 , floor ((1 - histquantile) * length (times))])
441
445
# if median size of (bins with >10% average data/bin) is less than 5% of max bin size, log the bin sizes
442
- if median (filter (b -> b > 0.1 * length (t . times) / histwidth, bins)) / maximum (bins) < 0.05
446
+ if median (filter (b -> b > 0.1 * length (times) / histwidth, bins)) / maximum (bins) < 0.05
443
447
bins, logbins = log .(1 .+ bins), true
444
448
end
445
449
hist = asciihist (bins, histheight)
@@ -448,8 +452,8 @@ function Base.show(io::IO, ::MIME"text/plain", t::Trial)
448
452
449
453
delta1 = (histtimes[end ] - histtimes[1 ]) / (histwidth - 1 )
450
454
if delta1 > 0
451
- medpos = 1 + round (Int, (histtimes[length (t . times) ÷ 2 ] - histtimes[1 ]) / delta1)
452
- avgpos = 1 + round (Int, (mean (t . times) - histtimes[1 ]) / delta1)
455
+ medpos = 1 + round (Int, (histtimes[length (times) ÷ 2 ] - histtimes[1 ]) / delta1)
456
+ avgpos = 1 + round (Int, (mean (times) - histtimes[1 ]) / delta1)
453
457
else
454
458
medpos, avgpos = 1 , 1
455
459
end
0 commit comments