Skip to content

Commit 39cd650

Browse files
committed
try pgo for benchmarks run
1 parent 4420be3 commit 39cd650

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

.github/workflows/codspeed.yml

+21-1
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,39 @@ jobs:
4141
if: steps.cache-py.outputs.cache-hit != 'true'
4242

4343
- name: install rust stable
44+
id: rust-toolchain
4445
uses: dtolnay/rust-toolchain@stable
46+
with:
47+
components: llvm-tools
4548

4649
- name: cache rust
4750
uses: Swatinem/rust-cache@v2
4851

49-
- name: Install pydantic-core
52+
- name: Compile pydantic-core for profiling
53+
# build-prod does not include MiMalloc because it bypasses Maturin
54+
run: |
55+
pip install -e .
56+
make build-prod
57+
python -c 'import pydantic_core'
58+
env:
59+
CONST_RANDOM_SEED: 0 # Fix the compile time RNG seed
60+
RUSTFLAGS: "-Cprofile-generate=${{ github.workspace }}/profdata"
61+
62+
- name: Gather pgo data
63+
run: pytest
64+
65+
- name: Prepare merged pgo data
66+
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'
67+
68+
- name: Compile pydantic-core for benchmarking
5069
# build-prod does not include MiMalloc because it bypasses Maturin
5170
run: |
5271
pip install -e .
5372
make build-prod
5473
python -c 'import pydantic_core'
5574
env:
5675
CONST_RANDOM_SEED: 0 # Fix the compile time RNG seed
76+
RUSTFLAGS: "-Cprofile-use=${{ github.workspace }}/merged.profdata"
5777

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

0 commit comments

Comments
 (0)