Skip to content

Commit fb66afb

Browse files
committed
refactor: update BCR benchmark visualization with improved axes and labels
1 parent a7b8ba9 commit fb66afb

File tree

1 file changed

+46
-8
lines changed

1 file changed

+46
-8
lines changed

benchmarks/Symbolics/BCR.jmd

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -193,15 +193,53 @@ pretty_table(tabledata; header, backend = Val(:html))
193193
```
194194

195195
```julia
196-
f = Figure(size = (800, 1200));
197-
labels = ["Symbolic jacobian time", "Symbolic jacobian\nallocated memory (B)", "`build_function` time", "First call time", "Second call time"]
196+
f = Figure(size = (750, 400))
197+
titles = [
198+
"Jacobian symbolic computation", "Jacobian symbolic computation", "Code generation",
199+
"Numerical function compilation", "Numerical function evaluation"]
200+
labels = ["Time (seconds)", "Allocated memory (bytes)",
201+
"Time (seconds)", "Time (seconds)", "Time (seconds)"]
198202
times = [jacobian_times, jacobian_allocs, build_times, first_call_times, second_call_times]
199-
for (i, (label, data)) in enumerate(zip(labels, times))
200-
ax = Axis(f[i, 1], xscale = log10, yscale = log10, ylabel = label, xticks = N)
201-
l1 = lines!(ax, N, data[1])
202-
l2 = lines!(ax, N, data[2])
203-
legend_entries = startswith(label, "Symbolic") ? ["without hashconsing", "with hashconsing"] : ["without CSE", "with CSE"]
204-
Legend(f[i, 2], [l1, l2], legend_entries)
203+
axes = Axis[]
204+
for i in 1:2
205+
label = labels[i]
206+
data = times[i]
207+
ax = Axis(f[1, i], xscale = log10, yscale = log10, xlabel = "model size",
208+
xlabelsize = 10, ylabel = label, ylabelsize = 10, xticks = N,
209+
title = titles[i], titlesize = 12, xticklabelsize = 10, yticklabelsize = 10)
210+
push!(axes, ax)
211+
l1 = scatterlines!(ax, N, data[1], label = "without hashconsing")
212+
l2 = scatterlines!(ax, N, data[2], label = "with hashconsing")
205213
end
214+
Legend(f[1, 3], axes[1], "Methods", tellwidth = false, labelsize = 12, titlesize = 15)
215+
axes2 = Axis[]
216+
# make equal y-axis unit length
217+
mn3, mx3 = extrema(reduce(vcat, times[3]))
218+
xn3 = log10(mx3 / mn3)
219+
mn4, mx4 = extrema(reduce(vcat, times[4]))
220+
xn4 = log10(mx4 / mn4)
221+
mn5, mx5 = extrema(reduce(vcat, times[5]))
222+
xn5 = log10(mx5 / mn5)
223+
xn = max(xn3, xn4, xn5)
224+
xn += 0.2
225+
hxn = xn / 2
226+
hxn3 = (log10(mx3) + log10(mn3)) / 2
227+
hxn4 = (log10(mx4) + log10(mn4)) / 2
228+
hxn5 = (log10(mx5) + log10(mn5)) / 2
229+
ylims = [(exp10(hxn3 - hxn), exp10(hxn3 + hxn)), (exp10(hxn4 - hxn), exp10(hxn4 + hxn)),
230+
(exp10(hxn5 - hxn), exp10(hxn5 + hxn))]
231+
for i in 1:3
232+
ir = i + 2
233+
label = labels[ir]
234+
data = times[ir]
235+
ax = Axis(f[2, i], xscale = log10, yscale = log10, xlabel = "model size",
236+
xlabelsize = 10, ylabel = label, ylabelsize = 10, xticks = N,
237+
title = titles[ir], titlesize = 12, xticklabelsize = 10, yticklabelsize = 10)
238+
ylims!(ax, ylims[i]...)
239+
push!(axes2, ax)
240+
l1 = scatterlines!(ax, N, data[1], label = "without hashconsing")
241+
l2 = scatterlines!(ax, N, data[2], label = "with hashconsing")
242+
end
243+
save("bcr.pdf", f)
206244
f
207245
```

0 commit comments

Comments
 (0)