feat(benchmarks): improve measurement accuracy and add missing benchmarks #29
Workflow file for this run
This file contains hidden or 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: Benchmark | |
| on: | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - ".github/workflows/benchmark.yml" | |
| - "pyproject.toml" | |
| - "src/**" | |
| - "tests/benchmarks/**" | |
| - "uv.lock" | |
| push: | |
| branches: [main] | |
| paths: | |
| - ".github/workflows/benchmark.yml" | |
| - "pyproject.toml" | |
| - "src/**" | |
| - "tests/benchmarks/**" | |
| - "uv.lock" | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| benchmark: | |
| name: "Benchmark (${{ matrix.shard }})" | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| permissions: | |
| contents: read | |
| id-token: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Fast tests (~7s/test) - can have more tests per shard | |
| - shard: "get" | |
| filter: "TestBenchGet" | |
| - shard: "count" | |
| filter: "TestBenchCount" | |
| - shard: "has" | |
| filter: "TestBenchHas" | |
| - shard: "find-one-delete" | |
| filter: "TestBenchFindOne or TestBenchDelete" | |
| # Moderate tests (~9s/test) | |
| - shard: "write-compact" | |
| filter: "TestBenchPut or TestBenchBatchWrite or TestBenchCompact" | |
| # I/O-heavy tests (~12s/test) | |
| - shard: "load" | |
| filter: "TestBenchLoad" | |
| - shard: "reload" | |
| filter: "TestBenchReload" | |
| - shard: "keys-ci" | |
| filter: "TestBenchKeys" | |
| marker: "benchmark and not slow" | |
| - shard: "keys-slow" | |
| filter: "TestBenchKeys" | |
| marker: "benchmark and slow" | |
| # Expensive tests (~15s/test) - split by slow marker | |
| - shard: "all-ci" | |
| filter: "TestBenchAll" | |
| marker: "benchmark and not slow" | |
| - shard: "all-slow" | |
| filter: "TestBenchAll" | |
| marker: "benchmark and slow" | |
| - shard: "items-ci" | |
| filter: "TestBenchItems" | |
| marker: "benchmark and not slow" | |
| - shard: "items-slow" | |
| filter: "TestBenchItems" | |
| marker: "benchmark and slow" | |
| # Find tests (~10s/test) | |
| - shard: "find-high" | |
| filter: "TestBenchFind and not TestBenchFindOne and test_find_high_selectivity" | |
| - shard: "find-other" | |
| filter: "TestBenchFind and not TestBenchFindOne and not test_find_high_selectivity" | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@ed21f2f24f8dd64503750218de024bcf64c7250a # v7.1.5 | |
| with: | |
| python-version: "3.10" | |
| enable-cache: true | |
| - name: Run benchmarks | |
| uses: CodSpeedHQ/action@346a2d8a8d9d38909abd0bc3d23f773110f076ad # v4.4.1 | |
| with: | |
| mode: simulation | |
| run: uv run pytest -m "${{ matrix.marker || 'benchmark' }}" -k "${{ matrix.filter }}" --codspeed |