Skip to content

Commit

Permalink
Add boxplots
Browse files Browse the repository at this point in the history
  • Loading branch information
VarLad committed May 21, 2024
1 parent f8727e1 commit b53538e
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 31 deletions.
1 change: 1 addition & 0 deletions ext/MakieExt/MakieExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ using PerfChecker
include("plotutils.jl")
include("allocs.jl")
include("bench.jl")
include("chair.jl")

end
43 changes: 14 additions & 29 deletions ext/MakieExt/bench.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,25 @@ function PerfChecker.checkres_to_scatterlines(
end

function PerfChecker.checkres_to_boxplots(
x::PerfChecker.CheckerResult, ::Val{:benchmark}; kwarg = :times)
x::PerfChecker.CheckerResult, ::Val{:benchmark}; kwarg::Symbol = :times)
di = Dict()
data = []
#for i in eachindex(x.tables)
#j = x.tables[i]
#p = x.pkgs[i]
#g = getproperties(j[i], (kwargs,))
#g = [g[k][1] for k in eachindex(g)]
#push!((fill(i, length(g)), g))
#end

#=
w = getproperties(j[1], (:allocs,))
versions = Dict()
for i in eachindex(x.pkgs)
versions[x.pkgs[i].version] = i
datax, datay = [], []

for i in eachindex(x.tables)
j = x.tables[i]
p = x.pkgs[i]
g = map(TypedTables.GetProperty{kwarg}(), j)
append!(datax, fill(i, length(g)))
append!(datay, g)
end

versionnums = [x.pkgs[i].version for i in eachindex(x.pkgs)]
versionnums = [x.pkgs[i].version for i in eachindex(x.pkgs)]
f = Figure()
ax = Axis(f[1, 1])
ax = f[1,1] = Axis(f)
ax.xticks = (eachindex(versionnums), string.(versionnums))
ax.xlabel = "versions"
ax.ylabel = "bytes"
colors = make_colors(length(keys(di)))
i = 1
for (keys, values) in di
xs = [values[i][1] for i in eachindex(values)]
ys = [versions[values[i][2]] for i in eachindex(values)]
scatterlines!(f[1,1], ys, xs, label = keys, color = (colors[i], 0.6)); i += 1
end
ax.title = x.pkgs[1].name
Legend(f[1,2], ax)
ax.ylabel = string(kwarg)
boxplot!(datax, datay, label=string(kwarg))
axislegend()
return f
=#
return data
end
29 changes: 29 additions & 0 deletions ext/MakieExt/chair.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
function PerfChecker.checkres_to_scatterlines(
x::PerfChecker.CheckerResult, ::Val{:chairmark})
println("Hello!")
@warn "Here!"
end

function PerfChecker.checkres_to_boxplots(
x::PerfChecker.CheckerResult, ::Val{:chairmark}; kwarg::Symbol = :times)
di = Dict()
datax, datay = [], []

for i in eachindex(x.tables)
j = x.tables[i]
p = x.pkgs[i]
g = map(TypedTables.GetProperty{kwarg}(), j)
append!(datax, fill(i, length(g)))
append!(datay, g)
end

versionnums = [x.pkgs[i].version for i in eachindex(x.pkgs)]
f = Figure()
ax = f[1,1] = Axis(f)
ax.xticks = (eachindex(versionnums), string.(versionnums))
ax.xlabel = "versions"
ax.ylabel = string(kwarg)
boxplot!(datax, datay, label=string(kwarg))
axislegend()
return f
end
2 changes: 1 addition & 1 deletion perf/PatternFolds/bench.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ end

@info t

#@info checkres_to_boxplots(t, Val(:benchmark))
checkres_to_boxplots(t, Val(:benchmark))
3 changes: 2 additions & 1 deletion perf/PatternFolds/chair.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using PerfChecker, Chairmarks
using PerfChecker, Chairmarks, CairoMakie

d = Dict(:path => @__DIR__, :evals => 1, :tags => [:patterns, :intervals],
:pkgs => ("PatternFolds", :custom, [v"0.2.2", v"0.2.3"], true))
Expand Down Expand Up @@ -30,3 +30,4 @@ end begin
end

@info t
checkres_to_boxplots(t, Val(:chairmark))

0 comments on commit b53538e

Please sign in to comment.