aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--analysis/vis.livemd42
1 files changed, 26 insertions, 16 deletions
diff --git a/analysis/vis.livemd b/analysis/vis.livemd
index f4b2ca6..727a459 100644
--- a/analysis/vis.livemd
+++ b/analysis/vis.livemd
@@ -6,7 +6,10 @@ Mix.install([
{:kino_vega_lite, "~> 0.1.8"},
{:json, "~> 1.4"},
{:explorer, "~> 0.8.0"},
- {:kino_explorer, "~> 0.1.11"}
+ {:kino_explorer, "~> 0.1.11"},
+ {:nx, "~> 0.5"},
+ {:scholar, "~> 0.2.1"},
+ {:math, "~> 0.7.0"}
])
```
@@ -17,7 +20,7 @@ require Explorer.DataFrame
require Explorer.Series
alias Explorer.DataFrame, as: DF
alias Explorer.Series, as: SE
-job_id = "1177"
+job_id = "other"
job_dir = Path.expand(~c"./" ++ job_id) |> Path.absname()
sections_dir = Path.join(job_dir, "sections")
cm_dir = Path.join([job_dir, "candelabra", "benchmark_results"])
@@ -93,9 +96,9 @@ cost_models
## Cost model exploratory plots
```elixir
-startn = 0
-endn = 60_000
-resolution = 100
+startn = 200
+endn = 2000
+resolution = 50
points_for = fn impl, op ->
%{"coeffs" => [coeffs]} =
@@ -103,16 +106,18 @@ points_for = fn impl, op ->
|> DF.to_columns()
Enum.map(startn..endn//resolution, fn n ->
+ t =
+ (coeffs
+ |> Enum.take(3)
+ |> Enum.with_index()
+ |> Enum.map(fn {coeff, idx} -> coeff * n ** idx end)
+ |> Enum.sum()) + Enum.at(coeffs, 3) * Math.log2(n)
+
%{
impl: String.split(impl, "::") |> List.last(),
op: op,
n: n,
- t:
- coeffs
- |> Enum.with_index()
- |> Enum.map(fn {coeff, idx} -> coeff * n ** idx end)
- |> Enum.sum()
- |> max(0)
+ t: t
}
end)
|> DF.new()
@@ -123,6 +128,7 @@ end
```elixir
inspect_op = "insert"
+impls = ["BTreeSet", "EagerSortedVec", "EagerUniqueVec", "HashSet"]
Tucan.layers([
cost_models
@@ -131,19 +137,23 @@ Tucan.layers([
|> DF.to_rows()
|> Enum.map(fn %{"impl" => impl} -> points_for.(impl, inspect_op) end)
|> DF.concat_rows()
- |> Tucan.lineplot("n", "t", color_by: "impl", clip: true)
- |> Tucan.Scale.set_y_domain(0, 200),
+ |> DF.filter(impl in ^impls)
+ |> Tucan.lineplot("n", "t", color_by: "impl", clip: true),
+ # |> Tucan.Scale.set_y_domain(0, 200)
Tucan.scatter(
cost_model_points
- |> DF.filter(op == ^inspect_op)
- |> DF.group_by(["impl", "n"])
- |> DF.summarise(t: mean(t)),
+ |> DF.filter(op == ^inspect_op and impl in ^impls)
+ |> DF.group_by(["impl", "n"]),
+ # |> DF.summarise(t: mean(t)),
"n",
"t",
color_by: "impl",
clip: true
)
])
+|> Tucan.Scale.set_x_domain(startn, endn)
+|> Tucan.Scale.set_y_domain(0, 200)
+|> Tucan.set_size(500, 500)
```
## Read benchmark data