|
| 1 | +name: Benchmarks |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: [main] |
| 6 | + paths: |
| 7 | + - 'crates/**' |
| 8 | + - 'benchmarks/download-fixtures.mjs' |
| 9 | + - 'Cargo.toml' |
| 10 | + - 'Cargo.lock' |
| 11 | + - '.github/workflows/bench.yml' |
| 12 | + push: |
| 13 | + branches: [main] |
| 14 | + paths: |
| 15 | + - 'crates/**' |
| 16 | + - 'benchmarks/download-fixtures.mjs' |
| 17 | + - 'Cargo.toml' |
| 18 | + - 'Cargo.lock' |
| 19 | + - '.github/workflows/bench.yml' |
| 20 | + workflow_dispatch: |
| 21 | + |
| 22 | +concurrency: |
| 23 | + group: bench-${{ github.ref }} |
| 24 | + cancel-in-progress: ${{ github.event_name == 'pull_request' }} |
| 25 | + |
| 26 | +permissions: {} |
| 27 | + |
| 28 | +env: |
| 29 | + CARGO_TERM_COLOR: always |
| 30 | + |
| 31 | +jobs: |
| 32 | + benchmark: |
| 33 | + name: CodSpeed simulation (${{ matrix.label }}) |
| 34 | + runs-on: ubuntu-latest |
| 35 | + timeout-minutes: 30 |
| 36 | + strategy: |
| 37 | + fail-fast: false |
| 38 | + matrix: |
| 39 | + include: |
| 40 | + - label: codec vlq |
| 41 | + cache_key: codec-vlq |
| 42 | + package: srcmap-codec |
| 43 | + bench: vlq |
| 44 | + fixtures: false |
| 45 | + - label: sourcemap parse |
| 46 | + cache_key: sourcemap-parse |
| 47 | + package: srcmap-sourcemap |
| 48 | + bench: parse |
| 49 | + fixtures: true |
| 50 | + - label: generator |
| 51 | + cache_key: generator |
| 52 | + package: srcmap-generator |
| 53 | + bench: generate |
| 54 | + fixtures: false |
| 55 | + - label: remapping |
| 56 | + cache_key: remapping |
| 57 | + package: srcmap-remapping |
| 58 | + bench: remap |
| 59 | + fixtures: false |
| 60 | + steps: |
| 61 | + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 |
| 62 | + |
| 63 | + - uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 |
| 64 | + |
| 65 | + - uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2 |
| 66 | + with: |
| 67 | + key: bench-${{ matrix.cache_key }} |
| 68 | + |
| 69 | + - name: Download real-world fixtures |
| 70 | + if: matrix.fixtures |
| 71 | + run: node benchmarks/download-fixtures.mjs |
| 72 | + |
| 73 | + - name: Install cargo-codspeed |
| 74 | + uses: taiki-e/install-action@15449e3094499af05d8d964a1c884208e4b8b595 # v2.81.11 |
| 75 | + with: |
| 76 | + tool: cargo-codspeed@4.7.0 |
| 77 | + |
| 78 | + - name: Build benchmark shard |
| 79 | + run: cargo codspeed build -p ${{ matrix.package }} --bench ${{ matrix.bench }} |
| 80 | + |
| 81 | + - name: Run benchmark shard |
| 82 | + uses: CodSpeedHQ/action@c145068895e045cc725ee76fcd2307624b65c3af # v4.17.5 |
| 83 | + with: |
| 84 | + mode: simulation |
| 85 | + run: cargo codspeed run -p ${{ matrix.package }} --bench ${{ matrix.bench }} |
0 commit comments