fix performance regression for JSON tagged union #3943
Workflow file for this run
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
name: codspeed | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
# `workflow_dispatch` allows CodSpeed to trigger backtest | |
# performance analysis in order to generate initial data. | |
workflow_dispatch: | |
env: | |
UV_FROZEN: true | |
UV_PYTHON: 3.13 | |
jobs: | |
benchmarks: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
# Using this action is still necessary for CodSpeed to work: | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.UV_PYTHON}} | |
- name: install uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
enable-cache: true | |
- name: install deps | |
run: | | |
uv sync --group testing | |
uv pip uninstall pytest-speed | |
uv pip install pytest-benchmark==4.0.0 pytest-codspeed | |
- name: install rust stable | |
id: rust-toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: llvm-tools | |
- name: cache rust | |
uses: Swatinem/rust-cache@v2 | |
- name: Compile pydantic-core for profiling | |
run: make build-profiling | |
env: | |
CONST_RANDOM_SEED: 0 # Fix the compile time RNG seed | |
RUSTFLAGS: "-Cprofile-generate=${{ github.workspace }}/profdata" | |
- name: Gather pgo data | |
run: uv run pytest tests/benchmarks | |
- name: Prepare merged pgo data | |
run: rustup run stable bash -c '$RUSTUP_HOME/toolchains/$RUSTUP_TOOLCHAIN/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-profdata merge -o ${{ github.workspace }}/merged.profdata ${{ github.workspace }}/profdata' | |
- name: Compile pydantic-core for benchmarking | |
run: make build-profiling | |
env: | |
CONST_RANDOM_SEED: 0 # Fix the compile time RNG seed | |
RUSTFLAGS: "-Cprofile-use=${{ github.workspace }}/merged.profdata" | |
- name: Run CodSpeed benchmarks | |
uses: CodSpeedHQ/action@v3 | |
with: | |
run: uv run pytest tests/benchmarks/ --codspeed |