Skip to content

Commit

Permalink
Update README with instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
noelwelsh committed Dec 15, 2023
1 parent 68c5492 commit b6b3af2
Showing 1 changed file with 34 additions and 2 deletions.
36 changes: 34 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,43 @@
# Stack Machine

A series of implementatinos of stack machines to optimize evaluation of arithmetic expressions.
A series of implementations of stack machines to investigate performance of interpreters on the JVM.


## Benchmarks

To run all benchmarks

`benchmarks / Jmh / run`

Example results
Example results are below.


To inspect performance:

1. Uncomment `javaOptions` in `build.sbt`.

2. It is not necessary to run the benchmarks for so many iterations. You can
instead use

```
benchmarks / Jmh / run -i 1 -wi 0 -f1 -t1 directThreadedFibBenchmark -prof jfr
```

replacing `directThreadedFibBenchmark` with the name of the benchmark you're
interested in. (This means: 1 iteration, 0 warmup iterations, 1 fork, 1
thread, record profiling information in JFR format)


### Analysis

Get JITWatch from https://github.com/AdoptOpenJDK/jitwatch/releases

`java -jar <jitwatch.jar>`

Open `hotspot_pidXXXXX.log` in the `benchmarks` directory.


### Benchmark Results

Ryzen 5 3600, JDK 21

Expand All @@ -18,6 +48,8 @@ Ryzen 5 3600, JDK 21
[info] FibonnaciBenchmark.baseFibBenchmark thrpt 25 2754.433 ± 18.351 ops/s
[info] FibonnaciBenchmark.basicStackFibBenchmark thrpt 25 676.426 ± 18.061 ops/s
[info] FibonnaciBenchmark.byteCodeFibBenchmark thrpt 25 4057.114 ± 69.842 ops/s
[info] FibonnaciBenchmark.directThreadedFibBenchmark thrpt 25 451783334.122 ± 18008803.137 ops/s
[info] FibonnaciBenchmark.directThreaded3FibBenchmark thrpt 25 528655333.613 ± 13105914.900 ops/s
[info] FibonnaciBenchmark.optimizedStack2FibBenchmark thrpt 25 3575.290 ± 45.085 ops/s
[info] FibonnaciBenchmark.optimizedStack3FibBenchmark thrpt 25 3567.815 ± 50.533 ops/s
[info] FibonnaciBenchmark.optimizedStackFibBenchmark thrpt 25 3631.189 ± 8.750 ops/s
Expand Down

0 comments on commit b6b3af2

Please sign in to comment.