Skip to content

Commit

Permalink
bench over time
Browse files Browse the repository at this point in the history
  • Loading branch information
Quafadas committed Sep 27, 2024
1 parent 0ad9c1c commit dd59781
Show file tree
Hide file tree
Showing 8 changed files with 324 additions and 36 deletions.
2 changes: 1 addition & 1 deletion build.sc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

import $ivy.`com.github.lolgab::mill-crossplatform::0.2.4`
import $ivy.`io.github.quafadas::millSite::0.0.31-DIRTY1d54e88b`
import $ivy.`io.github.quafadas::millSite::0.0.32`
import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.4.0`
import $ivy.`com.lihaoyi::mill-contrib-jmh:`

Expand Down
141 changes: 141 additions & 0 deletions site/docs/_assets/plots/countTrue.vg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"data": {
"url": "../../benchmarks/benchmark_history.json",
"format": {
"type": "json"
}
},
"transform": [
{
"calculate": "replace(datum.benchmark, 'vecxt.benchmark.', '')",
"as": "benchmark"
},
{
"calculate": "datetime(substring(datum.date,0, 4)+ '-' + substring(datum.date,4, 6) + '-' + substring(datum.date,6, 8))",
"as": "date"
},
{
"joinaggregate": [
{
"op": "max",
"field": "date",
"as": "maxDate"
}
]
},
{
"filter": {
"field": "benchmark",
"oneOf": [
"CountTrueBenchmark.countTrue_loop",
"CountTrueBenchmark.countTrue_loop_vec"
]
}
},
{
"window": [{ "op": "dense_rank", "as": "rank" }],
"sort": [{ "field": "date", "order": "descending" }]
},
{ "filter": "datum.rank <= 1" }
],
"vconcat": [
{
"layer": [
{
"mark": "errorbar",
"encoding": {
"x": {
"field": "scoreLowerConfidence",
"type": "quantitative",
"scale": { "zero": false },
"title": "ops / s"
},
"x2": { "field": "scoreUpperConfidence" },
"y": { "field": "benchmark", "type": "ordinal" }
}
},
{
"mark": {
"type": "point",
"filled": true,
"color": "black"
},
"encoding": {
"x": {
"field": "score",
"type": "quantitative"
},
"y": { "field": "benchmark", "type": "ordinal" }
}
}
],
"transform": [{ "filter": "(datum.params.len == '3')" }]
},
{
"layer": [
{
"mark": "errorbar",
"encoding": {
"x": {
"field": "scoreLowerConfidence",
"type": "quantitative",
"scale": { "zero": false },
"title": "ops / s"
},
"x2": { "field": "scoreUpperConfidence" },
"y": { "field": "benchmark", "type": "ordinal" }
}
},
{
"mark": {
"type": "point",
"filled": true,
"color": "black"
},
"encoding": {
"x": {
"field": "score",
"type": "quantitative"
},
"y": { "field": "benchmark", "type": "ordinal" }
}
}
],
"transform": [{ "filter": "(datum.params.len == '128')" }]
},

{
"layer": [
{
"mark": "errorbar",
"encoding": {
"x": {
"field": "scoreLowerConfidence",
"type": "quantitative",
"scale": { "zero": false },
"title": "ops / s"
},
"x2": { "field": "scoreUpperConfidence" },
"y": { "field": "benchmark", "type": "ordinal" }
}
},
{
"mark": {
"type": "point",
"filled": true,
"color": "black"
},
"encoding": {
"x": {
"field": "score",
"type": "quantitative"
},
"y": { "field": "benchmark", "type": "ordinal" }
}
}
],
"transform": [{ "filter": "(datum.params.len == '100000')" }]
}
]
}
133 changes: 133 additions & 0 deletions site/docs/_assets/plots/sum_over_time.vg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"data": {
"url": "../../benchmarks/benchmark_history.json",
"format": {
"type": "json"
}
},
"transform": [
{
"calculate": "replace(datum.benchmark, 'vecxt.benchmark.', '')",
"as": "benchmark"
},
{
"calculate": "datetime(substring(datum.date,0, 4)+ '-' + substring(datum.date,4, 6) + '-' + substring(datum.date,6, 8))",
"as": "date"
},
{
"filter": {
"field": "benchmark",
"oneOf": ["AddScalarBenchmark.vecxt_add_vec"]
}
},
{
"window": [{ "op": "dense_rank", "as": "rank" }],
"sort": [{ "field": "date", "order": "descending" }]
}
],
"vconcat": [
{
"layer": [
{
"title": "n = 10",
"mark": {
"type": "line",
"color": "black"
},
"encoding": {
"y": {
"field": "score",
"type": "quantitative",
"scale": { "zero": false },
"title": "ops/s"
},
"x": { "field": "date", "timeUnit": "date" }
}
},
{
"mark": { "opacity": 0.3, "type": "area", "color": "#85C5A6" },
"encoding": {
"x": { "field": "date", "timeUnit": "date" },
"y": {
"field": "scoreUpperConfidence",
"type": "quantitative"
},
"y2": {
"field": "scoreLowerConfidence"
}
}
}
],
"transform": [{ "filter": "(datum.params.n == '10')" }]
},
{
"layer": [
{
"title": "n = 1000",
"mark": {
"type": "line",
"color": "black"
},
"encoding": {
"y": {
"field": "score",
"type": "quantitative",
"scale": { "zero": false }
},
"x": { "field": "date", "timeUnit": "date" }
}
},
{
"mark": { "opacity": 0.3, "type": "area", "color": "#85C5A6" },
"encoding": {
"x": { "field": "date", "timeUnit": "date" },
"y": {
"field": "scoreUpperConfidence",
"type": "quantitative",
"title": "ops/s"
},
"y2": {
"field": "scoreLowerConfidence"
}
}
}
],
"transform": [{ "filter": "(datum.params.n == '1000')" }]
},
{
"layer": [
{
"title": "n = 1000000",
"mark": {
"type": "line",
"color": "black"
},
"encoding": {
"y": {
"field": "score",
"type": "quantitative",
"scale": { "zero": false },
"title": "ops/s"
},
"x": { "field": "date", "timeUnit": "date" }
}
},
{
"mark": { "opacity": 0.3, "type": "area", "color": "#85C5A6" },
"encoding": {
"x": { "field": "date", "timeUnit": "date" },
"y": {
"field": "scoreUpperConfidence",
"type": "quantitative"
},
"y2": {
"field": "scoreLowerConfidence"
}
}
}
],
"transform": [{ "filter": "(datum.params.n == '100000')" }]
}
]
}
16 changes: 16 additions & 0 deletions site/docs/_docs/benchmarks/countTrue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

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?bundle-deps=true";
var spec = "../../plots/sum.vg.json";
vegaEmbed('#vis', spec).then(function(result) {
// Access the Vega view instance (https://vega.github.io/vega/docs/api/view/) as result.view
}).catch(console.error);
</script>

# Conclusion
17 changes: 13 additions & 4 deletions site/docs/_docs/benchmarks/sum.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,22 @@ 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?bundle-deps=true";
import vegaEmbed from "https://cdn.jsdelivr.net/npm/vega-embed@6/+esm";
var spec = "../../plots/sum.vg.json";
vegaEmbed('#vis', spec).then(function(result) {
// Access the Vega view instance (https://vega.github.io/vega/docs/api/view/) as result.view
}).catch(console.error);
vegaEmbed('#vis', spec)
</script>

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>


The two implementations are;

```scala sc:nocompile
Expand Down
Loading

0 comments on commit dd59781

Please sign in to comment.