Skip to content

Commit 6af6f47

Browse files
committed
Update README for Python scripts
1 parent 49315c7 commit 6af6f47

1 file changed

Lines changed: 32 additions & 16 deletions

File tree

README.md

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@ to solving common JNI use-cases and then present the results.
99
The benchmarks at present are:
1010

1111
1. [com.evolvedbinary.jnibench.common.call](tree/main/src/main/java/com/evolvedbinary/jnibench/common/call) -
12-
Benchmarks for [Creating Objects with JNI](ObjectCreationBenchmarks.md)
13-
[(results)](ObjectCreationBenchmarks.md#object-creation-results).
12+
Benchmarks for [Creating Objects with JNI](ObjectCreationBenchmarks.md)
13+
[(results)](ObjectCreationBenchmarks.md#object-creation-results).
1414

1515
2. [com.evolvedbinary.jnibench.common.array](tree/main/src/main/java/com/evolvedbinary/jnibench/common/array) -
16-
Benchmarks for [Passing Arrays with JNI](ArrayPassingBenchmarks.md)
17-
[(results)](ArrayPassingBenchmarks.md#array-passing-results).
16+
Benchmarks for [Passing Arrays with JNI](ArrayPassingBenchmarks.md)
17+
[(results)](ArrayPassingBenchmarks.md#array-passing-results).
1818

19-
3. [com.evolvedbinary.jnibench.common.bytearray](tree/main/src/main/java/com/evolvedbinary/jnibench/common/bytearray), and [com.evolvedbinary.jnibench.common.getputjni](tree/main/src/main/java/com/evolvedbinary/jnibench/common/getputjni) - Benchmarks for [JNI Data Transfer](DataBenchmarks.md).
19+
3. [com.evolvedbinary.jnibench.common.bytearray](tree/main/src/main/java/com/evolvedbinary/jnibench/common/bytearray),
20+
and [com.evolvedbinary.jnibench.common.getputjni](tree/main/src/main/java/com/evolvedbinary/jnibench/common/getputjni) -
21+
Benchmarks for [JNI Data Transfer](DataBenchmarks.md).
2022

2123
# Reproducing
2224

@@ -40,29 +42,43 @@ can use `benchmark-100.sh` and/or `benchmark-100-with-close.sh`, or
4042

4143
## JMH support
4244

43-
We have support for running the tests via JMH, see `jmh-benchmarks.sh`. You can
44-
also pass `--help` to the script to see JMH options.
45-
4645
### Byte array benchmarks
4746

4847
There are two benchmarks, which are currently available only via JMH:
4948
ByteArrayFromNativeBenchmark and ByteArrayToNativeBenchmark. They can be run
50-
multiple times using `jmh-benchmarks-parametrized.sh` with:
49+
multiple times using `jmhrun.py` with:
5150

5251
```bash
53-
./jmh-benchmarks-parametrized.sh -i 10 -b ByteArrayToNativeBenchmark -o results/ -f csv
52+
python3 jmhrun.py -c jmh_tiny_array_from_native.json
5453
```
5554

56-
The above command will run JMH with `ByteArrayToNativeBenchmark` benchmarks `10` times and store result in CSV files in `results` directory. You can also pass `--help` to the script to see additional JMH options that can be used.
55+
The above command will run JMH with `ByteArrayFromNativeBenchmark` and store the result in CSV files in a subdirectory
56+
under `results` named via timestamp. You can also pass `--help` to the script to see additional JMH options that can be
57+
used.
58+
59+
The parameter
60+
61+
Results can then be plotted using the `jmhplot.py` script. For example, to produce results
62+
for the `ByteArrayFromNativeBenchmark` example above, you can run:
5763

58-
Results can then be plotted using the `process_byte_array_benchmarks_results.py` script. For example, to produce results for the `ByteArrayToNativeBenchmark` benchmarks, you can run:
5964
```bash
60-
python3 process_byte_array_benchmarks_results.py -p results/ --param-name "Param: keySize" --chart-title "Performance comparison of passing byte array with {} bytes via JNI"
65+
python3 jmhplot.py -f results/jmh_2026-01-29T12:11:26.472664
6166
```
6267

63-
Command line parameter `p` expects a path to the directory with the JMH result CSV files from running the benchmarks with `jmh-benchmarks-parametrized.sh`.
64-
The `{}` in the `chart-title` parameter will be replaced by the value from the `param-name` column.
68+
(Replace the `-f` parameter with the appropriate directory path.)
69+
70+
Command line parameter `f` expects a path to the directory with the JMH result CSV files from running the benchmarks
71+
with `jmhrun.py`.
72+
Some benchmarks will require an additional parameter `-c` like this:
73+
74+
```bash
75+
python3 jmhplot.py -f results/jmh_2026-01-29T12:11:26.472664 -c jmh_plot_iterator.json
76+
```
77+
78+
The script creates the resulting graphs in the same directory as the one where it finds the CSV files.
6579

6680
# Other Resources
67-
1. Java Foreign Interface prototype and performance results in RocksJava (i.e. Panama) - https://rocksdb.org/blog/2024/02/20/foreign-function-interface.html
81+
82+
1. Java Foreign Interface prototype and performance results in RocksJava (i.e.
83+
Panama) - https://rocksdb.org/blog/2024/02/20/foreign-function-interface.html
6884
2. RocksJava API Performance Improvements - https://rocksdb.org/blog/2023/11/06/java-jni-benchmarks.html

0 commit comments

Comments
 (0)