Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Quafadas committed Sep 27, 2024
1 parent dd59781 commit 333549a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
3 changes: 3 additions & 0 deletions site/docs/_assets/plots/addScalar.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
{
"layer": [
{
"title": "n = 3",
"mark": "errorbar",
"encoding": {
"x": {
Expand Down Expand Up @@ -76,6 +77,7 @@
{
"layer": [
{
"title": "n = 1000",
"mark": "errorbar",
"encoding": {
"x": {
Expand Down Expand Up @@ -109,6 +111,7 @@
{
"layer": [
{
"title": "n = 100000",
"mark": "errorbar",
"encoding": {
"x": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",

"data": {
"url": "../../benchmarks/benchmark_history.json",
"format": {
Expand Down Expand Up @@ -30,7 +31,7 @@
{
"layer": [
{
"title": "n = 10",
"title": "n = 3",
"mark": {
"type": "line",
"color": "black"
Expand Down
1 change: 1 addition & 0 deletions site/docs/_assets/plots/sum.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
{
"layer": [
{
"title": "n = 3",
"mark": "errorbar",
"encoding": {
"x": {
Expand Down
15 changes: 14 additions & 1 deletion site/docs/_docs/benchmarks/addScalar.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ 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>

And a comparison over time.

<div id="visTime" 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/addScalar.vg.json";
Expand All @@ -13,8 +17,17 @@ Here is the comparison of the standard `while` loop with the vectorised version.
}).catch(console.error);
</script>

And over time

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


# Conclusion

To my surprise, the vectorised version is slower than the standard `while` loop, in nearly each case and across the two environments I have to test in.

It could be, that the JDK is simply very good at optimising this case. Feedback welcomed - but as the standard while loop outperforms the vectorised version, the standard while loop is left included.
It could be, that the JDK is simply very good at optimising this case. Feedback welcomed - but as the standard while loop outperforms the vectorised version, the standard `while loop` version is left included.

0 comments on commit 333549a

Please sign in to comment.