Skip to content

Commit 47006c6

Browse files
committed
Applied requested changes
1 parent ab91a7d commit 47006c6

File tree

2 files changed

+29
-26
lines changed

2 files changed

+29
-26
lines changed

.github/workflows/longitudinal-benchmark.yml

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# Longitudinal Benchmarking
1+
# Longitudinal Benchmarks
22
#
33
# This workflow will run the benchmarks defined in the environment variable BENCHMARKS.
44
# It will collect and aggreate the benchmark output, format it and feed it to github-action-benchmark.
55
#
66
# The benchmark charts are live at https://input-output-hk.github.io/plutus/dev/bench
77
# The benchmark data is available at https://input-output-hk.github.io/plutus/dev/bench/data.js
88

9-
name: Longitudinal Benchmarking
9+
name: Longitudinal Benchmarks
1010

1111
on:
1212
push:
@@ -20,9 +20,9 @@ permissions:
2020
contents: write
2121

2222
jobs:
23-
new-benchmark:
23+
longitudinal-benchmarks:
2424
name: Performance regression check
25-
runs-on: ubuntu-latest
25+
runs-on: [self-hosted, plutus-benchmark]
2626
steps:
2727
- uses: actions/[email protected]
2828

@@ -33,33 +33,13 @@ jobs:
3333
for bench in $BENCHMARKS; do
3434
2>&1 cabal run "$bench" | tee "$bench-output.txt"
3535
done
36+
python ./scripts/format-benchmark-output.py
3637
37-
read -r -d '' PYTHON_SCRIPT <<- END_SCRIPT
38-
import json
39-
result = []
40-
for benchmark in "$BENCHMARKS".split():
41-
with open(f"{benchmark}-output.txt", "r") as file:
42-
name = ""
43-
for line in file.readlines():
44-
if line.startswith("benchmarking"):
45-
name = line.split()[1]
46-
elif line.startswith("mean"):
47-
parts = line.split()
48-
mean = parts[1]
49-
unit = parts[2]
50-
result.append({
51-
"name": f"{benchmark}-{name}",
52-
"unit": unit,
53-
"value": float(mean)
54-
})
55-
with open("output.json", "w") as file:
56-
json.dump(result, file)
57-
END_SCRIPT
5838
5939
- name: Store benchmark result
6040
uses: benchmark-action/[email protected]
6141
with:
62-
name: My Project Go Benchmark
42+
name: Plutus Benchmarks
6343
tool: 'customSmallerIsBetter'
6444
output-file-path: output.json
6545
github-token: ${{ secrets.GITHUB_TOKEN }}

scripts/format-benchmark-output.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import json
2+
import os
3+
4+
result = []
5+
6+
for benchmark in os.getenv("BENCHMARKS").split():
7+
with open(f"{benchmark}-output.txt", "r") as file:
8+
name = ""
9+
for line in file.readlines():
10+
if line.startswith("benchmarking"):
11+
name = line.split()[1]
12+
elif line.startswith("mean"):
13+
parts = line.split()
14+
mean = parts[1]
15+
unit = parts[2]
16+
result.append({
17+
"name": f"{benchmark}-{name}",
18+
"unit": unit,
19+
"value": float(mean)
20+
})
21+
22+
with open("output.json", "w") as file:
23+
json.dump(result, file)

0 commit comments

Comments
 (0)