Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
37ad1b9
Add pytest-benchmark infrastructure with bloom filter benchmarks
liquidsec Aug 14, 2025
0688e06
Complete GitHub Actions workflow integration with branch-based benchm…
liquidsec Aug 14, 2025
717b365
removing ai slop
liquidsec Aug 14, 2025
756d3c1
cleanup
liquidsec Aug 14, 2025
527f018
handle first run
liquidsec Aug 14, 2025
61a4e9f
escaping
liquidsec Aug 14, 2025
28bb950
refinements
liquidsec Aug 14, 2025
31b96cf
visual tweaks
liquidsec Aug 14, 2025
1b0b3a5
run on every branch
liquidsec Aug 14, 2025
37ad392
fixing AI slop
liquidsec Aug 14, 2025
706a049
report tweak
liquidsec Aug 14, 2025
26bc1b4
event validation benchmark
liquidsec Aug 15, 2025
f7dd83d
Fix GitHub Actions benchmark comment update logic
liquidsec Aug 15, 2025
059266e
collapsible when theres no comparison
liquidsec Aug 15, 2025
b50d099
better report structure
liquidsec Aug 15, 2025
d2d0152
more report formatting
liquidsec Aug 15, 2025
10d3386
more tests
liquidsec Aug 15, 2025
f29f40c
remove stupid tests
liquidsec Aug 15, 2025
64a2ca4
lint
liquidsec Aug 21, 2025
8d4f872
poetry.lock
liquidsec Aug 21, 2025
eddf81f
add excavate benchmarks
liquidsec Aug 22, 2025
1012841
fix tests
liquidsec Aug 22, 2025
effa071
increase benchmark
liquidsec Aug 22, 2025
7c31bcf
a much better excavate benchmark
liquidsec Aug 22, 2025
117e147
tweaking benchmark report
liquidsec Aug 22, 2025
505e361
fixing excavate test
liquidsec Aug 22, 2025
71e78f0
lint
liquidsec Aug 22, 2025
800b847
add regex report initial
liquidsec Aug 22, 2025
37e5f57
lint again
liquidsec Aug 22, 2025
436cce2
improved report format
liquidsec Aug 22, 2025
3e5f8c2
skip more folders
liquidsec Aug 22, 2025
e7134c8
dont test untestable regex
liquidsec Aug 22, 2025
50b6dee
emoji
liquidsec Aug 22, 2025
c9ae154
Fix regex benchmarks being mixed with regular benchmarks in comparison
liquidsec Aug 22, 2025
2b50b54
Fix comment detection to handle emoji in report title
liquidsec Aug 22, 2025
eeba1b1
Fix regex analysis lookup path in generate_report function
liquidsec Aug 22, 2025
be541e0
Move regex analysis outside benchmark success check
liquidsec Aug 22, 2025
cf3e386
Initialize data structures with machine_info for regex analysis
liquidsec Aug 22, 2025
c1f3a8e
Fix report variable scope issue in generate_report function
liquidsec Aug 22, 2025
e2db947
lint
liquidsec Aug 22, 2025
59d8bec
new benchmarks
liquidsec Aug 22, 2025
a549f54
Merge branch 'dev' into benchmark-tests
liquidsec Aug 22, 2025
15c503c
lint
liquidsec Aug 22, 2025
37a6ff7
Merge remote-tracking branch 'refs/remotes/origin/benchmark-tests' in…
liquidsec Aug 22, 2025
43e9da5
better commenting behavior, show results even without target branch data
liquidsec Aug 22, 2025
50f9191
maybe finally fixing comment behavior
liquidsec Aug 22, 2025
a1092d9
Merge branch 'dev' into benchmark-tests
liquidsec Aug 25, 2025
669ae9a
deps stuff
liquidsec Aug 25, 2025
68864e0
improve excavate benchmark, remove regex testing for now
liquidsec Aug 27, 2025
dc6b739
Merge branch 'dev' into benchmark-tests
liquidsec Aug 27, 2025
a7d8c3c
poetry.lock
liquidsec Aug 27, 2025
b7624b1
lint
liquidsec Aug 27, 2025
0d90f7c
bug fix
liquidsec Aug 27, 2025
785d9f9
Fix benchmark ops/sec calculation: use correct operation counts for m…
liquidsec Aug 27, 2025
c302cab
Fix event validation benchmark tests ConfigTypeError
liquidsec Aug 27, 2025
e2d7dcb
lint
liquidsec Aug 27, 2025
bced885
cosmetic
liquidsec Aug 27, 2025
63eb668
just some minor adjustments
liquidsec Aug 28, 2025
06a127b
more iterations
liquidsec Aug 28, 2025
9c50bd5
renaming test names
liquidsec Sep 3, 2025
111dc1e
Merge branch 'dev' into benchmark-tests
liquidsec Sep 3, 2025
e76e1b8
poetry.lock update
liquidsec Sep 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
166 changes: 166 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
name: Performance Benchmarks

on:
pull_request:
paths:
- 'bbot/**/*.py'
- 'pyproject.toml'
- '.github/workflows/benchmark.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions:
contents: read
pull-requests: write

jobs:
benchmark:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Need full history for branch comparison

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install dependencies
run: |
pip install poetry
poetry install --with dev

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libmagic1

# Generate benchmark comparison report using our branch-based script
- name: Generate benchmark comparison report
run: |
poetry run python bbot/scripts/benchmark_report.py \
--base ${{ github.base_ref }} \
--current ${{ github.head_ref }} \
--output benchmark_report.md \
--keep-results
continue-on-error: true

# Upload benchmark results as artifacts
- name: Upload benchmark results
uses: actions/upload-artifact@v4
with:
name: benchmark-results
path: |
benchmark_report.md
base_benchmark_results.json
current_benchmark_results.json
retention-days: 30

# Comment on PR with benchmark results
- name: Comment benchmark results on PR
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');

try {
const report = fs.readFileSync('benchmark_report.md', 'utf8');

// Find existing benchmark comment (with pagination)
const comments = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
per_page: 100, // Get more comments per page
});

// Debug: log all comments to see what we're working with
console.log(`Found ${comments.data.length} comments on this PR`);
comments.data.forEach((comment, index) => {
console.log(`Comment ${index}: user=${comment.user.login}, body preview="${comment.body.substring(0, 100)}..."`);
});

const existingComments = comments.data.filter(comment =>
comment.body.toLowerCase().includes('performance benchmark') &&
comment.user.login === 'github-actions[bot]'
);

console.log(`Found ${existingComments.length} existing benchmark comments`);

if (existingComments.length > 0) {
// Sort comments by creation date to find the most recent
const sortedComments = existingComments.sort((a, b) =>
new Date(b.created_at) - new Date(a.created_at)
);

const mostRecentComment = sortedComments[0];
console.log(`Updating most recent benchmark comment: ${mostRecentComment.id} (created: ${mostRecentComment.created_at})`);

await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: mostRecentComment.id,
body: report
});
console.log('Updated existing benchmark comment');

// Delete any older duplicate comments
if (existingComments.length > 1) {
console.log(`Deleting ${existingComments.length - 1} older duplicate comments`);
for (let i = 1; i < sortedComments.length; i++) {
const commentToDelete = sortedComments[i];
console.log(`Attempting to delete comment ${commentToDelete.id} (created: ${commentToDelete.created_at})`);

try {
await github.rest.issues.deleteComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: commentToDelete.id
});
console.log(`Successfully deleted duplicate comment: ${commentToDelete.id}`);
} catch (error) {
console.error(`Failed to delete comment ${commentToDelete.id}: ${error.message}`);
console.error(`Error details:`, error);
}
}
}
} else {
// Create new comment
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: report
});
console.log('Created new benchmark comment');
}
} catch (error) {
console.error('Failed to post benchmark results:', error);

// Post a fallback comment
const fallbackMessage = [
'## Performance Benchmark Report',
'',
'> ⚠️ **Failed to generate detailed benchmark comparison**',
'> ',
'> The benchmark comparison failed to run. This might be because:',
'> - Benchmark tests don\'t exist on the base branch yet',
'> - Dependencies are missing',
'> - Test execution failed',
'> ',
'> Please check the [workflow logs](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.',
'> ',
'> 📁 Benchmark artifacts may be available for download from the workflow run.'
].join('\\n');

await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: fallbackMessage
});
}
Loading