Skip to content

Commit

Permalink
continue benchmark plot refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Quafadas committed Nov 16, 2024
1 parent 8f62dfd commit d25933f
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 14 deletions.
32 changes: 32 additions & 0 deletions jsSite/src/BenchmarkPlots.scala
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,36 @@ object BenchmarkPlots:
write(thePlot)
end matMulBenchmark

def sumBenchmark =
val thePlot = BenchmarkPlotElements.schema ++
BenchmarkPlotElements.data("../../benchmarks/benchmark_history.json") ++
(
transform = BenchmarkPlotElements.transform(
List("SumBenchmark.sum_loop", "SumBenchmark.sum_vec")
)
) ++ (vconcat =
List(
BenchmarkPlotElements.layer(3, "len"),
BenchmarkPlotElements.layer(100, "len"),
BenchmarkPlotElements.layer(100000, "len")
)
)

write(thePlot)
end sumBenchmark

def sumBenchmarkOverTime: String =
val thePlot = BenchmarkPlotElements.schema ++
BenchmarkPlotElements.data("../../benchmarks/benchmark_history.json") ++
// BenchmarkPlotElements.fakeData ++
(transform = BenchmarkPlotElements.timeTransform(List("SumBenchmark.sum_vec"))) ++
(vconcat =
List(
BenchmarkPlotElements.timeLayer(3, "len"),
BenchmarkPlotElements.timeLayer(1000, "len"),
BenchmarkPlotElements.timeLayer(100000, "len")
)
)
write(thePlot)
end sumBenchmarkOverTime
end BenchmarkPlots
3 changes: 3 additions & 0 deletions site/docs/_docs/benchmarks/addScalar.mdoc.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
---
title: scalar addition
---

You may need to refresh the page.
https://github.com/scala/scala3/issues/21637
Expand Down
3 changes: 3 additions & 0 deletions site/docs/_docs/benchmarks/booleans.mdoc.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
---
title: logical operations
---

You may need to refresh the page.
https://github.com/scala/scala3/issues/21637
Expand Down
3 changes: 3 additions & 0 deletions site/docs/_docs/benchmarks/matmul.mdoc.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
---
title: matmul
---

You may need to refresh the page.
https://github.com/scala/scala3/issues/21637
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
---
title: Sum
---

You may need to refresh the page.
https://github.com/scala/scala3/issues/21637

Here is the comparison of the standard `while` loop with the vectorised version.
<div id="vis" style="width: 50vw;height: 10vh"></div>

<script type="module">
import vegaEmbed from "https://cdn.jsdelivr.net/npm/vega-embed@6/+esm";
var spec = "../../plots/sum.vg.json";
vegaEmbed('#vis', spec)
</script>
```scala mdoc:js sc:nocompile
import vecxt.plot.*
import vecxt.facades.*
showJsDocs.fromSpec(BenchmarkPlots.sumBenchmark, node)
```

And the function left in vexct over time (against regressions)

<div id="visTime" style="width: 50vw;height: 10vh"></div>

<script type="module">
import vegaEmbed from "https://cdn.jsdelivr.net/npm/vega-embed@6/+esm";
var spec = "../../plots/sum_over_time.vg.json";
vegaEmbed('#visTime', spec)
</script>

```scala mdoc:js sc:nocompile
import vecxt.plot.*
import vecxt.facades.*
showJsDocs.fromSpec(BenchmarkPlots.sumBenchmarkOverTime, node)
```

The two implementations are;

Expand Down

0 comments on commit d25933f

Please sign in to comment.