-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate plots of performance results
- Loading branch information
1 parent
c34b4dc
commit fbaa073
Showing
8 changed files
with
378 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,6 @@ indent_style = tab | |
|
||
[*.uk] | ||
indent_style = tab | ||
|
||
[*.py] | ||
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import glob | ||
import json | ||
import os | ||
|
||
|
||
if __name__ == '__main__': | ||
img_urls = json.loads(os.environ['IMG_URLS']) | ||
img_files = glob.glob('dist/results/plots/*.png') | ||
for (url, file) in zip(img_urls, img_files): | ||
name = file.split('/')[-1].split('.')[0] | ||
print(f"## {name}") | ||
print(f"![{name}]({url})\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,13 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install uv | ||
run: | | ||
pipx install uv | ||
touch README.md | ||
mkdir -p src/jsonschema_benchmark | ||
touch src/jsonschema_benchmark/__init__.py | ||
- run: make | ||
- run: cat dist/report.csv | ||
- name: Read CSV | ||
|
@@ -29,3 +36,14 @@ jobs: | |
MARKDOWN_TABLE: ${{ steps.csv-table-output.outputs.markdown-table }} | ||
run: echo "$MARKDOWN_TABLE" >> $GITHUB_STEP_SUMMARY | ||
|
||
- run: make plots | ||
- name: Upload plots | ||
id: imgur | ||
uses: devicons/[email protected] | ||
with: | ||
path: dist/results/plots/*.png | ||
client_id: ${{secrets.IMGUR_CLIENT_ID}} | ||
- name: Add plots to summary | ||
env: | ||
IMG_URLS: ${{ steps.imgur.outputs.imgur_urls }} | ||
run: python .github/plot_markdown.py >> $GITHUB_STEP_SUMMARY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* | ||
!.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from collections import defaultdict | ||
import csv | ||
|
||
import matplotlib.pyplot as plt | ||
import pandas as pd | ||
import seaborn as sns | ||
|
||
|
||
|
||
if __name__ == "__main__": | ||
examples = defaultdict(list) | ||
with open("dist/report.csv") as f: | ||
reader = csv.DictReader(f) | ||
for row in reader: | ||
row['milliseconds'] = float(row['nanoseconds']) / 1e6 | ||
examples[row["name"]].append(row) | ||
|
||
for (name, data) in examples.items(): | ||
data = pd.DataFrame(data) | ||
plt.figure(figsize=(4, 3), dpi=96) | ||
plot = sns.barplot(data, x="implementation", y="milliseconds", errorbar=None) | ||
plot.set(xlabel=None) | ||
plot.get_figure().savefig(f"dist/results/plots/{name}.png", dpi=96) | ||
plt.clf() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[project] | ||
name = "jsonschema-benchmark" | ||
version = "0.1.0" | ||
description = "Add your description here" | ||
readme = "README.md" | ||
requires-python = ">=3.12" | ||
dependencies = [ | ||
"seaborn>=0.13.2", | ||
] | ||
|
||
[build-system] | ||
requires = ["hatchling"] | ||
build-backend = "hatchling.build" |