Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Benchmarks #1673

Merged
merged 38 commits into from
Jan 5, 2023
Merged

Benchmarks #1673

merged 38 commits into from
Jan 5, 2023

Conversation

janmasrovira
Copy link
Collaborator

@janmasrovira janmasrovira commented Dec 20, 2022

This pr automatizes the process of compiling, running and plotting the results of the existing benchmark suite.
It is enough to run cabal/stack bench. The generated files will be placed in .benchmark-results.
In order to generate the plots we use gnuplot, which needs to be installed in the system.

Some suites have not been included because the juvix version was crashing and there is no point in benchmarking the other languages. This will need to be changed when we complete the pipeline (#1531 and #1665).

  • If the binaries need to be recompiled, delete .benchmark-results/bin
  • If the benchmarks need to be run again, delete .benchmark-results/csv
  • If the benchmarks need to be replotted, delete .benchmark-results/plot

It took 40 minutes to run the benchmarks on my pc.
I have included a time limit of 30 seconds for each benchmark. This should probably be adjusted. Maybe we could try adjusting the confidence interval parameter instead.

After running cabal bench, the contents of .benchmark-results are:

 .benchmark-results
├──  bin
│  ├──  fibonacci
│  │  ├──  c
│  │  │  ├──  fibonacci.exe
│  │  │  └──  fibonacci.wasm
│  │  ├──  haskell
│  │  │  ├──  fibonacci.exe
│  │  │  └──  fibonacci.strict.exe
│  │  ├──  juvix
│  │  │  ├──  fibonacci.exe
│  │  │  └──  fibonacci.wasm
│  │  ├──  ocaml
│  │  │  ├──  fibonacci.byte.exe
│  │  │  └──  fibonacci.exe
│  │  └──  runtime
│  │     ├──  fibonacci.exe
│  │     └──  fibonacci.wasm
│  ├──  fold
│  │  ├──  haskell
│  │  │  ├──  fold.exe
│  │  │  └──  fold.strict.exe
│  │  ├──  juvix
│  │  │  ├──  fold.exe
│  │  │  └──  fold.wasm
│  │  ├──  ocaml
│  │  │  ├──  fold.byte.exe
│  │  │  └──  fold.exe
│  │  └──  runtime
│  │     ├──  fold.exe
│  │     └──  fold.wasm
│  ├──  mapfold
│  │  ├──  haskell
│  │  │  ├──  mapfold.exe
│  │  │  └──  mapfold.strict.exe
│  │  ├──  juvix
│  │  │  ├──  mapfold.exe
│  │  │  └──  mapfold.wasm
│  │  ├──  ocaml
│  │  │  ├──  mapfold.byte.exe
│  │  │  └──  mapfold.exe
│  │  └──  runtime
│  │     ├──  mapfold.exe
│  │     └──  mapfold.wasm
│  ├──  maybe
│  │  ├──  c
│  │  │  ├──  maybe.exe
│  │  │  └──  maybe.wasm
│  │  ├──  haskell
│  │  │  ├──  maybe.exe
│  │  │  └──  maybe.strict.exe
│  │  ├──  juvix
│  │  │  ├──  maybe.exe
│  │  │  └──  maybe.wasm
│  │  ├──  ocaml
│  │  │  ├──  maybe.byte.exe
│  │  │  └──  maybe.exe
│  │  └──  runtime
│  │     ├──  maybe.exe
│  │     └──  maybe.wasm
│  └──  mergesort
│     ├──  c
│     │  ├──  mergesort.exe
│     │  └──  mergesort.wasm
│     ├──  haskell
│     │  ├──  mergesort.exe
│     │  └──  mergesort.strict.exe
│     ├──  juvix
│     │  ├──  mergesort.exe
│     │  └──  mergesort.wasm
│     ├──  ocaml
│     │  ├──  mergesort.byte.exe
│     │  └──  mergesort.exe
│     └──  runtime
│        ├──  mergesort.exe
│        └──  mergesort.wasm
├──  csv
│  ├──  fibonacci.csv
│  ├──  fold.csv
│  ├──  mapfold.csv
│  ├──  maybe.csv
│  └──  mergesort.csv
└──  plot
   ├──  fibonacci.svg
   ├──  fold.svg
   ├──  mapfold.svg
   ├──  maybe.svg
   └──  mergesort.svg

Generated plots:
fibonacci

fold

mapfold

maybe

mergesort

mapfun

prime

cps

combinations

ackermann

bench/Variants.hs Outdated Show resolved Hide resolved
bench/Variants.hs Outdated Show resolved Hide resolved
bench/Compile.hs Outdated Show resolved Hide resolved
@janmasrovira janmasrovira self-assigned this Jan 3, 2023
@janmasrovira janmasrovira added this to the 0.2.9 milestone Jan 3, 2023
janmasrovira and others added 4 commits January 3, 2023 19:04
Now it's possible to write `1 + 2` in the Juvix REPL and not get an
error.

Closes #1645.

Co-authored-by: Jonathan Cubides <jonathan.cubides@uib.no>
@janmasrovira janmasrovira marked this pull request as ready for review January 3, 2023 18:35
@lukaszcz
Copy link
Collaborator

lukaszcz commented Jan 4, 2023

Regarding the increase in speed, I think fiddling with the confidence intervals is a good idea. But maybe it's possible to change the confidence intervals individually for different benchmarks? It's fine to have a much wider confidence interval if the measured value is 10 times bigger than all other values, but less so when values are close. And the benchmarks taking most time are probably the outliers, so it might be useful to have much larger intervals for them.

Copy link
Collaborator

@lukaszcz lukaszcz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think all benchmarks should be included. If the current version of Juvix crashes, then this just should be noted on the plot / in the results. The crashes are for two reasons: no guarantee for tail-recursion (likely a stack overflow) or incorrect compilation of partial application (likely segfault / address boundary error).

@lukaszcz
Copy link
Collaborator

lukaszcz commented Jan 4, 2023

I think there is a point in benchmarking the runtime against other languages even if current Juvix crashes.

@janmasrovira
Copy link
Collaborator Author

I have included all Suites but excluded the variants that crash. I've removed the explicit time limit and put a confidence interval of 90 for every suite. We may want to try different values globally and for each suite, but I propose that we postone this for a later pr.

@janmasrovira janmasrovira merged commit 6a571e3 into main Jan 5, 2023
@janmasrovira janmasrovira deleted the benchmarks branch January 5, 2023 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants