Skip to content

Update benchmark.yaml #3

Update benchmark.yaml

Update benchmark.yaml #3

Workflow file for this run

name: Benchmarks
on:
push:
branches: [stwo-backend]
pull_request:
branches: [stwo-backend]
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "--cfg tokio_unstable" # Enable unstable features if needed
jobs:
benchmark:
name: Run benchmarks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Get full history for benchmarking across commits
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2024-01-04
components: rustfmt, clippy
- name: Cache dependencies
uses: actions/cache@v3
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 required packages
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libssl-dev
- name: Run benchmarks
run: |
cargo +nightly-2024-01-04 bench --bench tensor_ops -- --output-format criterion | tee output.txt
- name: Create benchmark summary
run: |
mkdir -p target/criterion/summary
cat > target/criterion/summary/index.html << 'EOL'
<!DOCTYPE html>
<html>
<head>
<title>Circuit Operation Benchmarks</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu;
margin: 0;
padding: 2rem;
line-height: 1.5;
}
.container {
max-width: 1200px;
margin: 0 auto;
}
.operation {
margin: 2rem 0;
padding: 2rem;
border-radius: 8px;
background: #f8f9fa;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
h1 {
color: #2c3e50;
margin-bottom: 2rem;
}
h2 {
color: #34495e;
border-bottom: 2px solid #eee;
padding-bottom: 0.5rem;
}
.phase-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 1rem;
margin-top: 1rem;
}
.phase-card {
background: white;
padding: 1rem;
border-radius: 6px;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.phase-card h3 {
margin-top: 0;
color: #3498db;
}
a {
color: #3498db;
text-decoration: none;
transition: color 0.2s;
}
a:hover {
color: #2980b9;
text-decoration: underline;
}
.commit-info {
margin-top: 2rem;
padding: 1rem;
background: #e1f5fe;
border-radius: 6px;
}
</style>
</head>
<body>
<div class="container">
<h1>Circuit Operation Benchmarks</h1>
<div class="commit-info">
<strong>Latest Commit:</strong> ${{ github.sha }}
<br>
<strong>Run Date:</strong> $(date)
</div>
<div class="operation">
<h2>TensorAdd</h2>
<div class="phase-grid">
<div class="phase-card">
<h3>Trace Generation</h3>
<a href="../TensorAdd/trace_generation/report/">View Results</a>
</div>
<div class="phase-card">
<h3>Proving</h3>
<a href="../TensorAdd/proving/report/">View Results</a>
</div>
<div class="phase-card">
<h3>Verification</h3>
<a href="../TensorAdd/verification/report/">View Results</a>
</div>
</div>
</div>
</div>
</body>
</html>
EOL
- name: Store benchmark results
uses: benchmark-action/github-action-benchmark@v1
with:
name: Rust Circuit Benchmarks
tool: "criterion"
output-file-path: output.txt
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
alert-threshold: "150%"
comment-on-alert: true
fail-on-alert: true
gh-pages-branch: gh-pages
benchmark-data-dir-path: dev/bench/data
- name: Deploy benchmark results
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: target/criterion
publish_branch: gh-pages
keep_files: true