-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cec36b4
commit 082c684
Showing
5 changed files
with
144 additions
and
69 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Benchmark main | ||
|
||
on: | ||
push: | ||
paths-ignore: ["docs/**", "**.md"] | ||
branches: | ||
- main | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
micro_benchmarks: | ||
name: Micro Benchmarks | ||
runs-on: benchmarking-runner | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Rust | ||
uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
|
||
- name: Install Bencher CLI | ||
uses: bencherdev/bencher@main | ||
|
||
- name: Run Benchmarks | ||
run: | | ||
bencher run \ | ||
--project tailcall \ | ||
--branch main \ | ||
--testbed benchmarking-runner \ | ||
--token "${{ secrets.BENCHER_API_TOKEN }}" \ | ||
--adapter rust_criterion \ | ||
cargo bench |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Benchmark PR Run | ||
|
||
on: | ||
pull_request: | ||
paths-ignore: ["docs/**", "**.md"] | ||
types: [opened, reopened, edited, synchronize, labeled] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
micro_benchmarks_pr_run: | ||
name: Micro Benchmarks for PR | ||
if: "contains(github.event.pull_request.labels.*.name, 'ci: benchmark')" | ||
runs-on: benchmarking-runner | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Run Benchmarks | ||
run: cargo bench > benchmark_results.txt | ||
- name: Upload Benchmark Results | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: benchmark_results.txt | ||
path: ./benchmark_results.txt | ||
- name: Upload GitHub Pull Request Event | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: event.json | ||
path: ${{ github.event_path }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: Benchmark PR Track | ||
|
||
on: | ||
workflow_run: | ||
workflows: [Benchmark PR Run] | ||
types: [completed] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
micro_benchmarks_pr_track: | ||
if: github.event.workflow_run.conclusion == 'success' | ||
runs-on: ubuntu-latest | ||
env: | ||
BENCHMARK_RESULTS: benchmark_results.txt | ||
PR_EVENT: event.json | ||
steps: | ||
- name: Download Benchmark Results | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
async function downloadArtifact(artifactName) { | ||
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
run_id: context.payload.workflow_run.id, | ||
}); | ||
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { | ||
return artifact.name == artifactName | ||
})[0]; | ||
if (!matchArtifact) { | ||
core.setFailed(`Failed to find artifact: ${artifactName}`); | ||
} | ||
let download = await github.rest.actions.downloadArtifact({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
artifact_id: matchArtifact.id, | ||
archive_format: 'zip', | ||
}); | ||
let fs = require('fs'); | ||
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/${artifactName}.zip`, Buffer.from(download.data)); | ||
} | ||
await downloadArtifact(process.env.BENCHMARK_RESULTS); | ||
await downloadArtifact(process.env.PR_EVENT); | ||
- name: Unzip Benchmark Results | ||
run: | | ||
unzip $BENCHMARK_RESULTS.zip | ||
unzip $PR_EVENT.zip | ||
- name: Export PR Event Data | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
let fs = require('fs'); | ||
let prEvent = JSON.parse(fs.readFileSync(process.env.PR_EVENT, {encoding: 'utf8'})); | ||
core.exportVariable("PR_HEAD", `${prEvent.number}/merge`); | ||
core.exportVariable("PR_BASE", prEvent.pull_request.base.ref); | ||
core.exportVariable("PR_BASE_SHA", prEvent.pull_request.base.sha); | ||
core.exportVariable("PR_NUMBER", prEvent.number); | ||
- uses: bencherdev/bencher@main | ||
- name: Track Benchmarks with Bencher | ||
run: | | ||
bencher run \ | ||
--project tailcall \ | ||
--token '${{ secrets.BENCHER_API_TOKEN }}' \ | ||
--branch '${{ env.PR_HEAD }}' \ | ||
--branch-start-point '${{ env.PR_BASE }}' \ | ||
--branch-start-point-hash '${{ env.PR_BASE_SHA }}' \ | ||
--testbed benchmarking-runner \ | ||
--adapter rust_criterion \ | ||
--err \ | ||
--github-actions '${{ secrets.GITHUB_TOKEN }}' \ | ||
--ci-number '${{ env.PR_NUMBER }}' \ | ||
--file "$BENCHMARK_RESULTS" |
082c684
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running 30s test @ http://localhost:8000/graphql
4 threads and 100 connections
419398 requests in 30.01s, 2.10GB read
Requests/sec: 13974.02
Transfer/sec: 71.72MB