Skip to content

Commit 3bf4515

Browse files
committed
Add release benchmark docs
1 parent 307fa6a commit 3bf4515

20 files changed

Lines changed: 1531 additions & 1 deletion

.github/workflows/generated-docs-sync.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@ on:
1515
- 'scripts/build_schema_docs.py'
1616
- 'scripts/build_conformance_docs.py'
1717
- 'scripts/build_architecture_docs.py'
18+
- 'scripts/build_release_benchmark_docs.py'
1819
- 'scripts/build_llms_txt.py'
1920
- 'scripts/update_generate_prompt_snapshots.py'
2021
- 'scripts/update_docs_version.py'
22+
- 'docs/data/release-benchmarks.json'
23+
- 'docs/assets/benchmarks/release-benchmarks.svg'
2124
- 'tox.ini'
2225
- '.github/workflows/generated-docs-sync.yaml'
2326
- 'docs/**/*.md'
@@ -66,6 +69,8 @@ jobs:
6669
docs/presets.md
6770
docs/conformance.md
6871
docs/architecture.md
72+
docs/performance-benchmarks.md
73+
docs/assets/benchmarks/release-benchmarks.svg
6974
docs/cli-reference/
7075
docs/llms.txt
7176
docs/llms-full.txt

.github/workflows/llms-txt.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ on:
1313
- 'scripts/build_preset_docs.py'
1414
- 'src/datamodel_code_generator/parser/schema_version.py'
1515
- 'scripts/build_schema_docs.py'
16+
- 'scripts/build_release_benchmark_docs.py'
17+
- 'docs/data/release-benchmarks.json'
18+
- 'docs/assets/benchmarks/release-benchmarks.svg'
1619
- 'docs/**/*.md'
1720
- 'README.md'
1821
- 'zensical.toml'
@@ -67,5 +70,7 @@ jobs:
6770
run: .tox/schema-docs/bin/python scripts/build_schema_docs.py
6871
- name: Build preset docs
6972
run: .tox/preset-docs/bin/python scripts/build_preset_docs.py
73+
- name: Build release benchmark docs
74+
run: .tox/llms-txt/bin/python scripts/build_release_benchmark_docs.py
7075
- name: Build llms.txt
7176
run: .tox/llms-txt/bin/python scripts/build_llms_txt.py
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
name: Release Benchmarks
2+
3+
on:
4+
pull_request:
5+
types: [labeled]
6+
workflow_run:
7+
workflows: ["Publish"]
8+
types: [completed]
9+
workflow_dispatch:
10+
inputs:
11+
versions:
12+
description: "Release tags or versions to benchmark. Leave empty to backfill from recent releases."
13+
required: false
14+
default: ""
15+
limit:
16+
description: "Number of recent releases to benchmark when versions is empty."
17+
required: false
18+
default: "10"
19+
runs:
20+
description: "Measured runs per release/input/formatter case."
21+
required: false
22+
default: "7"
23+
python_version:
24+
description: "Python version used to install and run released packages."
25+
required: false
26+
default: "3.14.2"
27+
28+
concurrency:
29+
group: release-benchmarks-${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.ref }}
30+
cancel-in-progress: false
31+
32+
permissions:
33+
contents: read
34+
35+
jobs:
36+
collect:
37+
name: Collect release benchmarks
38+
runs-on: ubuntu-24.04
39+
if: >-
40+
${{
41+
github.event_name == 'workflow_dispatch' ||
42+
(
43+
github.event_name == 'pull_request' &&
44+
github.event.action == 'labeled' &&
45+
github.event.label.name == 'run-release-benchmarks' &&
46+
github.event.pull_request.head.repo.full_name == github.repository
47+
) ||
48+
(
49+
github.event.workflow_run.conclusion == 'success' &&
50+
github.event.workflow_run.event == 'push' &&
51+
github.event.workflow_run.head_repository.full_name == github.repository
52+
)
53+
}}
54+
env:
55+
BENCHMARK_PYTHON_VERSION: ${{ github.event_name == 'workflow_dispatch' && inputs.python_version || '3.14.2' }}
56+
BENCHMARK_RUNS: ${{ github.event_name == 'workflow_dispatch' && inputs.runs || (github.event_name == 'pull_request' && '3' || '7') }}
57+
BENCHMARK_LIMIT: ${{ github.event_name == 'workflow_dispatch' && inputs.limit || (github.event_name == 'pull_request' && '3' || '10') }}
58+
OS: ubuntu-24.04
59+
steps:
60+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
61+
with:
62+
persist-credentials: false
63+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
64+
with:
65+
python-version: ${{ env.BENCHMARK_PYTHON_VERSION }}
66+
- name: Install the latest version of uv
67+
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
68+
- name: Resolve release versions
69+
id: versions
70+
env:
71+
GH_TOKEN: ${{ github.token }}
72+
EVENT_NAME: ${{ github.event_name }}
73+
WORKFLOW_TAG: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_branch || '' }}
74+
INPUT_VERSIONS: ${{ github.event_name == 'workflow_dispatch' && inputs.versions || '' }}
75+
run: |
76+
set -euo pipefail
77+
versions="$INPUT_VERSIONS"
78+
if [ "$EVENT_NAME" = "workflow_run" ]; then
79+
versions="$WORKFLOW_TAG"
80+
fi
81+
if [ -z "${versions//[[:space:],]/}" ]; then
82+
versions="$(gh release list \
83+
--exclude-drafts \
84+
--exclude-pre-releases \
85+
--limit "$BENCHMARK_LIMIT" \
86+
--json tagName \
87+
--jq '.[].tagName' | paste -sd, -)"
88+
fi
89+
if [ -z "${versions//[[:space:],]/}" ]; then
90+
echo "No release versions resolved" >&2
91+
exit 1
92+
fi
93+
{
94+
echo "versions<<EOF"
95+
printf '%s\n' "$versions"
96+
echo "EOF"
97+
} >> "$GITHUB_OUTPUT"
98+
- name: Collect benchmarks
99+
run: >-
100+
python scripts/collect_release_benchmarks.py
101+
--versions '${{ steps.versions.outputs.versions }}'
102+
--runs "$BENCHMARK_RUNS"
103+
--output .benchmarks/release-benchmarks.json
104+
- name: Build benchmark docs artifact
105+
run: >-
106+
python scripts/build_release_benchmark_docs.py
107+
--data .benchmarks/release-benchmarks.json
108+
--docs .benchmarks/docs/performance-benchmarks.md
109+
--svg .benchmarks/docs/assets/benchmarks/release-benchmarks.svg
110+
- name: Upload benchmark data
111+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
112+
with:
113+
name: dcg-release-benchmarks-json
114+
path: .benchmarks/release-benchmarks.json
115+
if-no-files-found: error
116+
- name: Upload benchmark docs
117+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
118+
with:
119+
name: dcg-release-benchmark-docs
120+
path: .benchmarks/docs
121+
if-no-files-found: error

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ Custom templates can emit Python outside the standard generated model patterns c
199199
custom-template output is not exhaustively validated. If `--formatters builtin` produces invalid or poorly formatted
200200
output with a custom template, please open an issue with a small reproducer. See
201201
[Formatter Behavior](https://datamodel-code-generator.koxudaxi.dev/formatter-behavior/) for details.
202+
203+
See [Performance Benchmarks](https://datamodel-code-generator.koxudaxi.dev/performance-benchmarks/) for release benchmark data and SVG charts.
202204
<!-- END AUTO-GENERATED PRESET QUICK START -->
203205

204206
---
@@ -213,6 +215,7 @@ output with a custom template, please open an issue with a small reproducer. See
213215
- ⚙️ [pyproject.toml](https://datamodel-code-generator.koxudaxi.dev/pyproject_toml/) - Configuration file
214216
- 🔄 [CI/CD Integration](https://datamodel-code-generator.koxudaxi.dev/ci-cd/) - GitHub Actions, pre-commit hooks
215217
-[Conformance Dashboard](https://datamodel-code-generator.koxudaxi.dev/conformance/) - External corpus coverage signals
218+
- 📈 [Performance Benchmarks](https://datamodel-code-generator.koxudaxi.dev/performance-benchmarks/) - Release benchmark tables and SVG charts
216219
- 🧭 [Architecture](https://datamodel-code-generator.koxudaxi.dev/architecture/) - Generation pipeline and synchronized component inventory
217220
- 🚀 [One-liner Usage](https://datamodel-code-generator.koxudaxi.dev/oneliner/) - uvx, pipx, clipboard integration
218221
-[FAQ](https://datamodel-code-generator.koxudaxi.dev/faq/) - Common questions
Lines changed: 15 additions & 0 deletions
Loading

docs/data/release-benchmarks.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"schema_version": 1,
3+
"metadata": {
4+
"generated_at": "",
5+
"workflow": "Release Benchmarks",
6+
"runs_per_case": ""
7+
},
8+
"entries": []
9+
}

docs/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ Custom templates can emit Python outside the standard generated model patterns c
200200
custom-template output is not exhaustively validated. If `--formatters builtin` produces invalid or poorly formatted
201201
output with a custom template, please open an issue with a small reproducer. See
202202
[Formatter Behavior](formatter-behavior.md) for details.
203+
204+
See [Performance Benchmarks](performance-benchmarks.md) for release benchmark data and SVG charts.
203205
<!-- END AUTO-GENERATED PRESET QUICK START -->
204206

205207
---
@@ -308,6 +310,7 @@ See [CI/CD Integration](ci-cd.md) for more options.
308310
- 🚀 **[One-liner Usage](oneliner.md)** - uvx, pipx, clipboard integration
309311
- 🔄 **[CI/CD Integration](ci-cd.md)** - GitHub Actions and CI validation
310312
- ✅ **[Conformance Dashboard](conformance.md)** - External corpus and CI coverage signals
313+
- 📈 **[Performance Benchmarks](performance-benchmarks.md)** - Release benchmark tables and SVG charts
311314
- 🎨 **[Custom Templates](custom_template.md)** - Customize generated code with Jinja2
312315
- 🖌️ **[Code Formatting](formatting.md)** - Configure black, isort, and ruff
313316
- ❓ **[FAQ](faq.md)** - Common questions and troubleshooting

docs/llms-full.txt

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,8 @@ Custom templates can emit Python outside the standard generated model patterns c
202202
custom-template output is not exhaustively validated. If `--formatters builtin` produces invalid or poorly formatted
203203
output with a custom template, please open an issue with a small reproducer. See
204204
[Formatter Behavior](formatter-behavior.md) for details.
205+
206+
See [Performance Benchmarks](performance-benchmarks.md) for release benchmark data and SVG charts.
205207
<!-- END AUTO-GENERATED PRESET QUICK START -->
206208

207209
---
@@ -310,6 +312,7 @@ See [CI/CD Integration](ci-cd.md) for more options.
310312
- 🚀 **[One-liner Usage](oneliner.md)** - uvx, pipx, clipboard integration
311313
- 🔄 **[CI/CD Integration](ci-cd.md)** - GitHub Actions and CI validation
312314
- ✅ **[Conformance Dashboard](conformance.md)** - External corpus and CI coverage signals
315+
- 📈 **[Performance Benchmarks](performance-benchmarks.md)** - Release benchmark tables and SVG charts
313316
- 🎨 **[Custom Templates](custom_template.md)** - Customize generated code with Jinja2
314317
- 🖌️ **[Code Formatting](formatting.md)** - Configure black, isort, and ruff
315318
- ❓ **[FAQ](faq.md)** - Common questions and troubleshooting
@@ -34905,6 +34908,39 @@ These suites are compatibility and coverage signals. They show that CI exercises
3490534908

3490634909
---
3490734910

34911+
# Performance Benchmarks
34912+
34913+
Source: https://datamodel-code-generator.koxudaxi.dev/performance-benchmarks/
34914+
34915+
<!-- Generated by scripts/build_release_benchmark_docs.py. Do not edit manually. -->
34916+
34917+
This page tracks datamodel-code-generator release benchmark results collected on GitHub Actions. The data is DCG-only and uses Ubuntu runners so release-to-release changes can be compared without mixing in third-party generator results.
34918+
34919+
![Release benchmark median generation time](assets/benchmarks/release-benchmarks.svg){ align=center }
34920+
34921+
## Collection Policy
34922+
34923+
- The benchmark workflow runs on `ubuntu-24.04`.
34924+
- The Python version is the workflow input, defaulting to the latest configured CI Python.
34925+
- Release packages are installed from PyPI in isolated virtual environments.
34926+
- Input coverage currently focuses on OpenAPI and JSON Schema.
34927+
- Historical backfills are produced by the `Release Benchmarks` workflow and committed after review.
34928+
34929+
## Latest Dataset
34930+
34931+
- Schema version: `1`
34932+
- Generated at: `-`
34933+
- Source workflow: `Release Benchmarks`
34934+
- Benchmark runs per case: `-`
34935+
34936+
## Release Results
34937+
34938+
No release benchmark data has been committed yet.
34939+
34940+
After this workflow is available on `main`, run it with `workflow_dispatch` and commit the generated `docs/data/release-benchmarks.json`, Markdown, and SVG artifacts.
34941+
34942+
---
34943+
3490834944
# Deprecations
3490934945

3491034946
Source: https://datamodel-code-generator.koxudaxi.dev/deprecations/

docs/llms.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979

8080

8181
- [Conformance Dashboard](https://datamodel-code-generator.koxudaxi.dev/conformance/): This page summarizes the external conformance and end-to-end corpus checks that CI runs for datamodel-code-generator. The table is generated from `...
82+
- [Performance Benchmarks](https://datamodel-code-generator.koxudaxi.dev/performance-benchmarks/): This page tracks datamodel-code-generator release benchmark results collected on GitHub Actions. The data is DCG-only and uses Ubuntu runners so re...
8283
- [Deprecations](https://datamodel-code-generator.koxudaxi.dev/deprecations/): This page lists deprecations and scheduled breaking changes.
8384
- [Experimental Features](https://datamodel-code-generator.koxudaxi.dev/experimental/): This page lists features that are available but still experimental.
8485
- [Architecture](https://datamodel-code-generator.koxudaxi.dev/architecture/): `datamodel-code-generator` is organized around one central idea: many input formats are normalized into a shared generation graph, then rendered th...

docs/performance-benchmarks.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Performance Benchmarks
2+
3+
<!-- Generated by scripts/build_release_benchmark_docs.py. Do not edit manually. -->
4+
5+
This page tracks datamodel-code-generator release benchmark results collected on GitHub Actions. The data is DCG-only and uses Ubuntu runners so release-to-release changes can be compared without mixing in third-party generator results.
6+
7+
![Release benchmark median generation time](assets/benchmarks/release-benchmarks.svg){ align=center }
8+
9+
## Collection Policy
10+
11+
- The benchmark workflow runs on `ubuntu-24.04`.
12+
- The Python version is the workflow input, defaulting to the latest configured CI Python.
13+
- Release packages are installed from PyPI in isolated virtual environments.
14+
- Input coverage currently focuses on OpenAPI and JSON Schema.
15+
- Historical backfills are produced by the `Release Benchmarks` workflow and committed after review.
16+
17+
## Latest Dataset
18+
19+
- Schema version: `1`
20+
- Generated at: `-`
21+
- Source workflow: `Release Benchmarks`
22+
- Benchmark runs per case: `-`
23+
24+
## Release Results
25+
26+
No release benchmark data has been committed yet.
27+
28+
After this workflow is available on `main`, run it with `workflow_dispatch` and commit the generated `docs/data/release-benchmarks.json`, Markdown, and SVG artifacts.

0 commit comments

Comments
 (0)