Skip to content

Commit

Permalink
ci: Update Bencher CLI usage (#3100)
Browse files Browse the repository at this point in the history
  • Loading branch information
epompeii authored Nov 20, 2024
1 parent 1a6bd64 commit 4f4336b
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 75 deletions.
49 changes: 15 additions & 34 deletions .github/workflows/benchmark_pr_track.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,43 +18,22 @@ jobs:
PR_EVENT: event.json
steps:
- name: Download Benchmark Results
uses: actions/github-script@v7
uses: dawidd6/action-download-artifact@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: ${{ env.BENCHMARK_RESULTS }}
run_id: ${{ github.event.workflow_run.id }}
- name: Download PR Event
uses: dawidd6/action-download-artifact@v6
with:
name: ${{ env.PR_EVENT }}
run_id: ${{ github.event.workflow_run.id }}
- name: Export PR Event Data
uses: actions/github-script@v7
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_HEAD", prEvent.pull_request.head.ref);
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);
Expand All @@ -64,12 +43,14 @@ jobs:
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 }}' \
--branch "$PR_HEAD" \
--start-point "$PR_BASE" \
--start-point-hash "$PR_BASE_SHA" \
--start-point-clone-thresholds \
--start-point-reset \
--testbed benchmarking-runner \
--adapter rust_criterion \
--err \
--github-actions '${{ secrets.GITHUB_TOKEN }}' \
--ci-number '${{ env.PR_NUMBER }}' \
--ci-number "$PR_NUMBER" \
--file "$BENCHMARK_RESULTS"
81 changes: 40 additions & 41 deletions tailcall-wasm/example/browser/index.html
Original file line number Diff line number Diff line change
@@ -1,48 +1,47 @@
<!doctype html>
<html lang="en-US">
<head>
<meta charset="utf-8" />
<title>hello-wasm example</title>
</head>
<body>
<head>
<meta charset="utf-8" />
<title>hello-wasm example</title>
</head>
<body>
<div id="content">
<!-- Adding input field and button -->
<label for="queryInput"></label><input type="text" id="queryInput" placeholder="Enter your query here" />
<button id="btn">Run Query</button>
<p id="result"></p>
</div>

<div id="content">
<!-- Adding input field and button -->
<label for="queryInput"></label><input type="text" id="queryInput" placeholder="Enter your query here" />
<button id="btn">Run Query</button>
<p id="result"></p>
</div>
<script type="module">
import init, {TailcallBuilder} from "../../browser/pkg/tailcall_wasm.js"
await init()

<script type="module">
import init, { TailcallBuilder } from "../../browser/pkg/tailcall_wasm.js";
await init();
let executor // Making executor accessible

let executor; // Making executor accessible
async function setup() {
try {
const urlParams = new URLSearchParams(window.location.search)
let schemaUrl = urlParams.get("config")

async function setup() {
try {
const urlParams = new URLSearchParams(window.location.search);
let schemaUrl = urlParams.get("config");

let builder = new TailcallBuilder();
builder = await builder.with_config(schemaUrl);
executor = await builder.build();
let btn = document.getElementById("btn");
btn.addEventListener("click", runQuery);
} catch (error) {
alert("error: " + error);
}
}
async function runQuery() {
let query = document.getElementById("queryInput").value;
try {
document.getElementById("result").textContent = await executor.execute(query);
} catch (error) {
console.error("Error executing query: " + error);
document.getElementById("result").textContent = "Error: " + error;
}
}
setup();
</script>
</body>
let builder = new TailcallBuilder()
builder = await builder.with_config(schemaUrl)
executor = await builder.build()
let btn = document.getElementById("btn")
btn.addEventListener("click", runQuery)
} catch (error) {
alert("error: " + error)
}
}
async function runQuery() {
let query = document.getElementById("queryInput").value
try {
document.getElementById("result").textContent = await executor.execute(query)
} catch (error) {
console.error("Error executing query: " + error)
document.getElementById("result").textContent = "Error: " + error
}
}
setup()
</script>
</body>
</html>

1 comment on commit 4f4336b

@github-actions
Copy link

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

Thread Stats Avg Stdev Max +/- Stdev
Latency 3.90ms 1.51ms 25.41ms 68.28%
Req/Sec 6.45k 214.75 7.20k 83.42%

770659 requests in 30.01s, 3.86GB read

Requests/sec: 25681.22

Transfer/sec: 131.81MB

Please sign in to comment.