From 2db5fa0ca22b967e0b9f359275278c95f690b4eb Mon Sep 17 00:00:00 2001 From: David Hewitt <1939362+davidhewitt@users.noreply.github.com> Date: Tue, 20 Jun 2023 17:15:08 +0100 Subject: [PATCH] try pgo for benchmarks run --- .github/workflows/codspeed.yml | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/codspeed.yml b/.github/workflows/codspeed.yml index 97cf2c15e..dde22effd 100644 --- a/.github/workflows/codspeed.yml +++ b/.github/workflows/codspeed.yml @@ -41,12 +41,31 @@ 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 . @@ -54,6 +73,7 @@ jobs: 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