diff options
Diffstat (limited to 'analysis/vis.livemd')
-rw-r--r-- | analysis/vis.livemd | 87 |
1 files changed, 79 insertions, 8 deletions
diff --git a/analysis/vis.livemd b/analysis/vis.livemd index a9e0037..360e2fe 100644 --- a/analysis/vis.livemd +++ b/analysis/vis.livemd @@ -163,13 +163,6 @@ Tucan.layers([ |> Tucan.Legend.set_orientation(:color, "bottom") ``` -```elixir -cost_model_points -|> DF.filter(impl == "LinkedList" and op == "remove") -|> DF.group_by("n") -|> DF.summarise(t: mean(t)) -``` - ## Read benchmark data ```elixir @@ -197,7 +190,9 @@ raw_benchmarks = using: Regex.scan(~r/\"(\w*)\", ([^)]*)/, Path.basename(dir)) |> Enum.map(fn [_, ctn, impl] -> %{ctn: ctn, impl: impl} end), - mean: raw_results["mean"]["point_estimate"] / 10 ** 9 + mean: raw_results["mean"]["point_estimate"] / 10 ** 9, + hi_95th: raw_results["mean"]["confidence_interval"]["upper_bound"] / 10 ** 9, + lo_95th: raw_results["mean"]["confidence_interval"]["lower_bound"] / 10 ** 9 } end) end) @@ -393,3 +388,79 @@ singular_benchmarks |> DF.filter(proj == "prime_sieve") |> DF.sort_by(time) ``` + +## Adaptive Containers + +```elixir +# Projects where an adaptive container was suggested +adaptive_projs = + (estimated_costs + |> DF.to_rows() + |> Enum.filter(fn %{"using" => using} -> + using + |> Enum.map(fn %{"impl" => impl} -> String.contains?(impl, "until") end) + |> Enum.any?() + end) + |> DF.new() + |> DF.distinct(["proj"]))["proj"] +``` + +```elixir +adaptive_estimated_costs = estimated_costs |> DF.filter(proj in ^adaptive_projs) + +adaptive_raw_benchmarks = + raw_benchmarks + |> DF.filter(proj in ^adaptive_projs) + +display_using = fn using -> + using + |> Enum.map(fn %{"ctn" => ctn, "impl" => impl} -> ctn <> "=" <> impl end) + |> Enum.join(", ") +end + +adaptive_raw_benchmarks = + adaptive_raw_benchmarks + |> DF.put( + "n", + adaptive_raw_benchmarks["bench_id"] + |> SE.split("/") + |> SE.transform(&Enum.at(&1, 1)) + ) + |> DF.put( + "using", + adaptive_raw_benchmarks["using"] + |> SE.transform(display_using) + ) +``` + +```elixir +best_usings = + adaptive_raw_benchmarks + |> DF.group_by(["proj", "using"]) + |> DF.filter(not contains(using, "until")) + |> DF.summarise(total: sum(mean)) + |> DF.group_by(["proj"]) + |> DF.filter(total == min(total)) + |> DF.discard("total") + |> DF.rename(%{"using" => "best_using"}) + |> DF.join(adaptive_raw_benchmarks) + |> DF.filter(using == best_using or contains(using, "until")) + |> DF.pivot_longer(["hi_95th", "lo_95th"]) + |> DF.select(["proj", "using", "n", "value"]) +``` + +```elixir +Tucan.errorbar( + best_usings + |> DF.filter(proj == "example_mapping"), + "value", + orient: :vertical, + ticks: true, + points: true, + group_by: "n" + # color_by: "using" +) +|> Tucan.Legend.set_orientation(:color, "bottom") +|> Tucan.Legend.put_options(:color, label_limit: 1000) +|> Tucan.set_size(500, 500) +``` |