Skip to content

Commit d2d6c48

Browse files
committed
try pgo for benchmarks run
1 parent f43fab3 commit d2d6c48

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

.github/workflows/codspeed.yml

+20-1
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,37 @@ 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+
# --no-default-features to avoid using mimalloc
54+
run: |
55+
pip install -e . --config-settings=build-args='--no-default-features --verbose' -v
56+
python -c 'import pydantic_core; assert pydantic_core._pydantic_core.__pydantic_core_default_allocator__'
57+
env:
58+
CONST_RANDOM_SEED: 0 # Fix the compile time RNG seed
59+
RUSTFLAGS: "-Cprofile-generate=${{ github.workspace }}/profdata"
60+
61+
- name: Gather pgo data
62+
run: pytest
63+
64+
- name: Prepare merged pgo data
65+
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'
66+
67+
- name: Compile pydantic-core for benchmarking
5068
# --no-default-features to avoid using mimalloc
5169
run: |
5270
pip install -e . --config-settings=build-args='--no-default-features --verbose' -v
5371
python -c 'import pydantic_core; assert pydantic_core._pydantic_core.__pydantic_core_default_allocator__'
5472
env:
5573
CONST_RANDOM_SEED: 0 # Fix the compile time RNG seed
74+
RUSTFLAGS: "-Cprofile-use=${{ github.workspace }}/merged.profdata"
5675

5776
- name: Run CodSpeed benchmarks
5877
uses: CodSpeedHQ/action@v1

0 commit comments

Comments
 (0)