Skip to content

Commit

Permalink
try pgo for benchmarks run
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhewitt committed Jun 20, 2023
1 parent 4420be3 commit 2db5fa0
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion .github/workflows/codspeed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,39 @@ jobs:
if: steps.cache-py.outputs.cache-hit != 'true'

- 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: Install pydantic-core
- name: Compile pydantic-core for profiling
# build-prod does not include MiMalloc because it bypasses Maturin
run: |
pip install -e .
make build-prod
python -c 'import pydantic_core'
env:
CONST_RANDOM_SEED: 0 # Fix the compile time RNG seed
RUSTFLAGS: "-Cprofile-generate=${{ github.workspace }}/profdata"

- name: Gather pgo data
run: pytest

- name: Prepare merged pgo data
run: ~/.rustup/toolchains/${{ steps.rust-toolchain.outputs.name }}/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
# build-prod does not include MiMalloc because it bypasses Maturin
run: |
pip install -e .
make build-prod
python -c 'import pydantic_core'
env:
CONST_RANDOM_SEED: 0 # Fix the compile time RNG seed
RUSTFLAGS: "-Cprofile-use=${{ github.workspace }}/merged.profdata"

# this is required so that pytest uses the installed package
- run: rm tests/__init__.py
Expand Down

0 comments on commit 2db5fa0

Please sign in to comment.