profiled with flamegraph to eliminate top hotspots, benchmarks using criterion #3
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 Comparison | |
| on: | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| bench-compare: | |
| name: Compare PR vs main | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install Rust stable | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install cargo-criterion | |
| run: cargo install cargo-criterion | |
| - name: Bench main branch | |
| run: | | |
| git checkout main | |
| cargo bench --bench search_benchmarks \ | |
| -- --save-baseline main 2>&1 | |
| - name: Bench PR branch | |
| run: | | |
| git checkout ${{ github.head_ref }} | |
| cargo bench --bench search_benchmarks \ | |
| -- --baseline main 2>&1 | tee comparison.txt | |
| - name: Post comparison comment | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const comparison = fs.readFileSync('comparison.txt', 'utf8'); | |
| const lines = comparison.split('\n') | |
| .filter(l => l.includes('time:') || l.includes('change:') || | |
| l.includes('Performance') || l.includes('No change')) | |
| .join('\n'); | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: '## Benchmark Comparison\n```\n' + lines + '\n```', | |
| }); |