perf: optimize enforcement and role-link hot paths #258
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
| on: | |
| pull_request: | |
| branches: [ master ] | |
| name: Benchmarks | |
| jobs: | |
| runBenchmark: | |
| name: run benchmark | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install Rust toolchain | |
| run: | | |
| rustup toolchain install stable --profile minimal | |
| rustup default stable | |
| - name: Cache cargo | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo- | |
| - name: Install critcmp | |
| run: cargo install critcmp --force | |
| - name: Run benchmarks on master | |
| run: | | |
| git checkout origin/master | |
| cd benches && cargo bench -- --save-baseline master | |
| - name: Run benchmarks on PR | |
| run: | | |
| git checkout ${{ github.sha }} | |
| cd benches && cargo bench -- --save-baseline changes | |
| - name: Generate benchmark comparison | |
| run: | | |
| cd benches && critcmp master changes > $GITHUB_WORKSPACE/benchmark_result.txt 2>&1 || true | |
| - name: Save PR number | |
| run: echo "${{ github.event.pull_request.number }}" > pr_number.txt | |
| - name: Upload benchmark results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: benchmark-results | |
| path: | | |
| benchmark_result.txt | |
| pr_number.txt |