Skip to content

Commit 7c9faab

Browse files
authored
Run individual workloads automatically instead of using manualRun in … (#168)
…the console It fixes Issue #2
1 parent 3d66d0b commit 7c9faab

8 files changed

Lines changed: 20 additions & 33 deletions

File tree

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ To propose a new workload, please add it to the `resources/experimental` directo
4545
- Add the workload to `resources/default-tests.mjs` with (optionally) the `Experimental-` prefix and `experimental` tag, analogous to the existing workloads.
4646
- Serve the overall runner via `npm run dev` in the repository root directory.
4747
- The experimental workloads are not part of default set of workloads. Browse to `http://localhost:8080/?developerMode`, select the added workloads alongside any other workloads and click "Start Test" to run the benchmark. You can find more instructions about how to use the Developer Mode in [Developer Mode and Custom Parameters](README.md#developer-mode-and-custom-parameters).
48-
- To run individual experimental workloads, navigate to `http://localhost:8080/resources/experimental/dist/<workload>.html` then do `manualRun()` in the dev console of the browser.
48+
- To run individual experimental workloads, navigate to `http://localhost:8080/resources/experimental/dist/<workload>.html`.
4949

5050
### Code Reviews
5151

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ See the Speedometer repo for a more detailed explanation, e.g., in which phases
2020

2121
- If you have not done that yet, run `npm install` and `npm run build` inside `resources/<workload-group>/` to produce output in `dist/`.
2222
- `npm run dev` in the root directory to start the server.
23-
- Navigate to `http://localhost:8080/resources/<workload-group>/dist/<workload>.html` (e.g. `http://localhost:8080/resources/transformers-js/dist/feature-extraction-cpu.html`) then do `manualRun()` in the developer console.
23+
- Navigate to `http://localhost:8080/resources/<workload-group>/dist/<workload>.html` (e.g. `http://localhost:8080/resources/transformers-js/dist/feature-extraction-cpu.html`) to run the workload automatically.
2424

2525
## Developer Mode and Custom Parameters
2626

about.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ <h1 class="section-header">About the Web AI Compute Benchmark</h1>
1818
<div class="section-content">
1919
<h2>Benchmark Version</h2>
2020
<ul>
21-
<li>Version: <!-- package-version -->0.2.0 (2026-05-05)<!-- /package-version --></li>
22-
<li>Git commit: <!-- git-commit-link --><a href="https://github.com/GoogleChrome/webai-compute-benchmark/commit/8907dfe2821d53b3fc5c2dfad5022d5a23d85e02" target="_blank">8907dfe</a><!-- /git-commit-link --></li>
21+
<li>Version: <!-- package-version -->0.2.0 (2026-05-15)<!-- /package-version --></li>
22+
<li>Git commit: <!-- git-commit-link --><a href="https://github.com/GoogleChrome/webai-compute-benchmark/commit/3d66d0b8f15eb4a2bf455bf7324855f3a67ae0d3" target="_blank">3d66d0b</a><!-- /git-commit-link --></li>
2323
</ul>
2424
<h2>Library Versions</h2>
2525
<ul>

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
Additionally, the first iteration of the benchmark <b>may take several minutes</b> to complete.
2929
</p>
3030
<p class="version-note">
31-
Version: <!-- package-version -->0.2.0 (2026-05-05)<!-- /package-version --> (commit: <!-- git-commit-link --><a href="https://github.com/GoogleChrome/webai-compute-benchmark/commit/8907dfe2821d53b3fc5c2dfad5022d5a23d85e02" target="_blank">8907dfe</a><!-- /git-commit-link -->)
31+
Version: <!-- package-version -->0.2.0 (2026-05-15)<!-- /package-version --> (commit: <!-- git-commit-link --><a href="https://github.com/GoogleChrome/webai-compute-benchmark/commit/3d66d0b8f15eb4a2bf455bf7324855f3a67ae0d3" target="_blank">3d66d0b</a><!-- /git-commit-link -->)
3232
</p>
3333
<p id="screen-size-warning">
3434
<strong>
@@ -89,7 +89,7 @@ <h1>Score</h1>
8989
<div class="version next">next</div>
9090
</a>
9191
<div class="section-grid">
92-
<h1 class="section-header">Detailed Results <!-- package-version -->0.2.0 (2026-05-05)<!-- /package-version --></h1>
92+
<h1 class="section-header">Detailed Results <!-- package-version -->0.2.0 (2026-05-15)<!-- /package-version --></h1>
9393
<div class="section-content all-metric-results">
9494
<div class="non-standard-params">
9595
<h2>Non-standard Parameters</h2>

resources/experimental/src/index.mjs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ import { createSubIteratedSuite } from "speedometer-utils/helpers.mjs";
33
import { pipeline, env } from '@huggingface/transformers';
44
import { params } from "speedometer-utils/params.mjs";
55

6-
/*
7-
Paste below into dev console for manual testing:
8-
manualRun();
9-
*/
106

117
// Please ensure that models are self-contained for this benchmark and not loaded remotely from a CDN or the Hugging Face Hub.
128

@@ -82,8 +78,3 @@ export async function initializeBenchmark(modelType) {
8278
const benchmarkConnector = new BenchmarkConnector(suites, appName, appVersion);
8379
benchmarkConnector.connect();
8480
}
85-
86-
globalThis.manualRun = () => {
87-
window.addEventListener("message", (event) => console.log(event.data));
88-
window.postMessage({ id: appName + '-' + appVersion, key: "benchmark-connector", type: "benchmark-suite", name: "default" }, "*");
89-
}

resources/litert-js/src/index.mjs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ import { loadAndCompile, loadLiteRt, Tensor } from '@litertjs/core';
66
import origamiImage from '../../media/image.jpg';
77
import handImage from '../../media/hand.jpg';
88

9-
/*
10-
Paste below into dev console for manual testing:
11-
manualRun();
12-
*/
139

1410
// TODO: Model loading time is not currently included in the benchmark. We should
1511
// investigate if the model loading code is different for the different device types.
@@ -377,8 +373,3 @@ export async function initializeBenchmark(modelType) {
377373
const benchmarkConnector = new BenchmarkConnector(suites, appName, appVersion);
378374
benchmarkConnector.connect();
379375
}
380-
381-
globalThis.manualRun = () => {
382-
window.addEventListener("message", (event) => console.log(event.data));
383-
window.postMessage({ id: appName + '-' + appVersion, key: "benchmark-connector", type: "benchmark-suite", name: "default" }, "*");
384-
}

resources/shared/benchmark.mjs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ export class BenchmarkConnector {
128128
console.error(`Suite with the name of "${event.data.name}" not found!`);
129129
const { result } = await suite.runAndRecord(params, (test) => this.sendMessage({ type: "step-complete", status: "success", appId: this.appId, name: this.name, test }));
130130
this.sendMessage({ type: "suite-complete", status: "success", appId: this.appId, result });
131+
if (window.top === window) {
132+
console.log("Running in individual mode. Benchmark execution complete.", result);
133+
}
131134
this.disconnect();
132135
break;
133136
default:
@@ -142,6 +145,17 @@ export class BenchmarkConnector {
142145
connect() {
143146
window.addEventListener("message", this.onMessage);
144147
this.sendMessage({ type: "app-ready", status: "success", appId: this.appId });
148+
149+
if (window.top === window) {
150+
console.log("Running in individual mode. Automatically starting benchmark...");
151+
// Trigger the run
152+
window.postMessage({
153+
id: this.appId,
154+
key: "benchmark-connector",
155+
type: "benchmark-suite",
156+
name: "default"
157+
}, "*");
158+
}
145159
}
146160

147161
disconnect() {

resources/transformers-js/src/index.mjs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ import { KokoroTTS } from "kokoro-js";
66
import jfkAudio from '../../media/jfk_1962_0912_spaceeffort.wav';
77
import imageWithBackground from '../../media/image.jpg';
88

9-
/*
10-
Paste below into dev console for manual testing:
11-
manualRun();
12-
*/
139

1410
// Workloads and models: https://docs.google.com/spreadsheets/d/1tRzuM34dUpijXcJwHmmK7-JDK6zZHhBPHECvBXEF0n8/edit?usp=sharing
1511
// Model selection documentation: https://docs.google.com/document/d/1EDyRD5dHxYpONyE_xf_Tb1A3GvNSrLQpp-msCcWNnF0/edit?usp=sharing
@@ -461,8 +457,3 @@ export async function initializeBenchmark(modelType) {
461457
const benchmarkConnector = new BenchmarkConnector(suites, appName, appVersion);
462458
benchmarkConnector.connect();
463459
}
464-
465-
globalThis.manualRun = () => {
466-
window.addEventListener("message", (event) => console.log(event.data));
467-
window.postMessage({ id: appName + '-' + appVersion, key: "benchmark-connector", type: "benchmark-suite", name: "default" }, "*");
468-
}

0 commit comments

Comments
 (0)