Skip to content

Commit 19188b9

Browse files
authored
Merge pull request #4 from ajinkya-k/ahk/comparative
added macro `@bcomp` to support comparative benchmarks added in Chairmarks v1.3
2 parents 9cd7cc9 + 0b117fe commit 19188b9

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/PrettyChairmarks.jl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ using Chairmarks
44
using Printf
55
import Statistics
66

7-
export @b, @be, @bs
7+
export @b, @be, @bs, @bcomp
88

99
prettypercent(p) = string(@sprintf("%.2f", p * 100), "%")
1010

@@ -90,6 +90,13 @@ macro bs(args...)
9090
:(PrettyBenchmark($call))
9191
end
9292

93+
macro bcomp(expr...)
94+
call = Chairmarks.process_args(expr)
95+
quote
96+
tuple([PrettyChairmarks.PrettyBenchmark(bnc) for bnc in $call]...)
97+
end
98+
end
99+
93100
_summary(io, t, args...) = withtypename(() -> print(io, args...), io, t)
94101

95102
Base.summary(io::IO, t::PrettyBenchmark) = _summary(io, t, prettytime(time(t)))
@@ -303,4 +310,6 @@ function Base.show(io::IO, ::MIME"text/plain", t1::PrettyBenchmark)
303310
return print(io, ".")
304311
end
305312

313+
Base.show(io::IO, m::MIME"text/plain", bmks::Tuple{Vararg{PrettyBenchmark}}) = for b in bmks Base.show(io, m, b) end
314+
306315
end

0 commit comments

Comments
 (0)