Skip to content

Commit f8e3d7e

Browse files
authored
Update/rewrite web-tooling-benchmark (#153)
The orignal benchmark [1] has been stale for a while and uses a more node-oriented build process. - Copy complete build scripts + sources to jetstream - Strip away the nodejs web-tooling-benchmark and standalone html-runner - Update each original workload to the latest version [1] https://github.com/v8/web-tooling-benchmark
1 parent 5be6cdc commit f8e3d7e

File tree

86 files changed

+672045
-531806
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+672045
-531806
lines changed

JetStreamDriver.js

Lines changed: 59 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ class Benchmark {
827827
if (this.plan.preload) {
828828
let preloadCode = "";
829829
for (let [ variableName, blobURLOrPath ] of this.preloads)
830-
preloadCode += `JetStream.preload.${variableName} = "${blobURLOrPath}";\n`;
830+
preloadCode += `JetStream.preload[${JSON.stringify(variableName)}] = "${blobURLOrPath}";\n`;
831831
scripts.add(preloadCode);
832832
}
833833

@@ -2530,7 +2530,7 @@ let BENCHMARKS = [
25302530
iterations: 15,
25312531
worstCaseCount: 2,
25322532
tags: ["Default", "Wasm", "dotnet"],
2533-
})
2533+
}),
25342534
];
25352535

25362536

@@ -2565,28 +2565,67 @@ BENCHMARKS.push(new GroupedBenchmark({
25652565
}, SUNSPIDER_BENCHMARKS))
25662566

25672567
// WTB (Web Tooling Benchmark) tests
2568-
const WTB_TESTS = [
2569-
"acorn",
2570-
"babylon",
2571-
"chai",
2572-
"coffeescript",
2573-
"espree",
2574-
"jshint",
2575-
"lebab",
2576-
"prepack",
2577-
"uglify-js",
2578-
];
2579-
for (const name of WTB_TESTS) {
2580-
BENCHMARKS.push(new DefaultBenchmark({
2568+
const WTB_TESTS = {
2569+
"acorn": true,
2570+
"babel": true,
2571+
"babel-minify": true,
2572+
"babylon": true,
2573+
"chai": true,
2574+
"espree": true,
2575+
"esprima-next": true,
2576+
// Disabled: Converting ES5 code to ES6+ is no longer a realistic scenario.
2577+
"lebab": false,
2578+
"postcss": true,
2579+
"prettier": true,
2580+
"source-map": true,
2581+
};
2582+
const WPT_FILES = [
2583+
"angular-material-20.1.6.css",
2584+
"backbone-1.6.1.js",
2585+
"bootstrap-5.3.7.css",
2586+
"foundation-6.9.0.css",
2587+
"jquery-3.7.1.js",
2588+
"lodash.core-4.17.21.js",
2589+
"lodash-4.17.4.min.js.map",
2590+
"mootools-core-1.6.0.js",
2591+
"preact-8.2.5.js",
2592+
"preact-10.27.1.min.module.js.map",
2593+
"redux-5.0.1.min.js",
2594+
"redux-5.0.1.esm.js",
2595+
"source-map.min-0.5.7.js.map",
2596+
"source-map/lib/mappings.wasm",
2597+
"speedometer-es2015-test-2.0.js",
2598+
"todomvc/react/app.jsx",
2599+
"todomvc/react/footer.jsx",
2600+
"todomvc/react/todoItem.jsx",
2601+
"todomvc/typescript-angular.ts",
2602+
"underscore-1.13.7.js",
2603+
"underscore-1.13.7.min.js.map",
2604+
"vue-3.5.18.runtime.esm-browser.js",
2605+
].reduce((acc, file) => {
2606+
acc[file] = `./web-tooling-benchmark/third_party/${file}`;
2607+
return acc
2608+
}, Object.create(null));
2609+
2610+
2611+
for (const [name, enabled] of Object.entries(WTB_TESTS)) {
2612+
const tags = ["WTB"];
2613+
if (enabled)
2614+
tags.push("Default");
2615+
BENCHMARKS.push(new AsyncBenchmark({
25812616
name: `${name}-wtb`,
25822617
files: [
2583-
(isInBrowser ? "./web-tooling-benchmark/browser.js" : "./web-tooling-benchmark/cli.js"),
2584-
`./web-tooling-benchmark/${name}.js`,
2618+
`./web-tooling-benchmark/dist/${name}.bundle.js`,
2619+
"./web-tooling-benchmark/benchmark.js",
25852620
],
2586-
iterations: 5,
2587-
worstCaseCount: 1,
2621+
preload: {
2622+
BUNDLE: `./web-tooling-benchmark/dist/${name}.bundle.js`,
2623+
...WPT_FILES,
2624+
},
2625+
iterations: 15,
2626+
worstCaseCount: 2,
25882627
allowUtf16: true,
2589-
tags: ["Default", "WTB"],
2628+
tags: tags,
25902629
}));
25912630
}
25922631

web-tooling-benchmark/LICENSE

Lines changed: 82 additions & 270 deletions
Large diffs are not rendered by default.

web-tooling-benchmark/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Web Tooling Benchmark
2+
3+
This is a clone/fork of the original [Web Tooling Benchmark](https://github.com/v8/web-tooling-benchmark).
4+
Unlike the original, this is a JetStream-oriented version.
5+
6+
This benchmark provides workloads for common web tools.
7+
8+
9+
## Build Instructions
10+
11+
```bash
12+
# install required node packages.
13+
npm ci
14+
# build the workload, output is ./dist
15+
npm run build
16+
```

web-tooling-benchmark/acorn.js

Lines changed: 0 additions & 30 deletions
This file was deleted.

web-tooling-benchmark/babylon.js

Lines changed: 0 additions & 30 deletions
This file was deleted.

web-tooling-benchmark/benchmark.js

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright (C) 2025 Apple Inc. All rights reserved.
3+
*
4+
* Redistribution and use in source and binary forms, with or without
5+
* modification, are permitted provided that the following conditions
6+
* are met:
7+
* 1. Redistributions of source code must retain the above copyright
8+
* notice, this list of conditions and the following disclaimer.
9+
* 2. Redistributions in binary form must reproduce the above copyright
10+
* notice, this list of conditions and the following disclaimer in the
11+
* documentation and/or other materials provided with the distribution.
12+
*
13+
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14+
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16+
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17+
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19+
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20+
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21+
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24+
*/
25+
26+
27+
28+
class Benchmark {
29+
files = Object.create(null);
30+
31+
async init() {
32+
let WTBenchmark;
33+
await this.loadAllFiles(JetStream.preload);
34+
this.sourceCode = this.files.BUNDLE;
35+
this.WTBenchmark = self.WTBenchmark;
36+
}
37+
38+
async loadAllFiles(preload) {
39+
const loadPromises = Object.entries(preload).map(
40+
async ([name, url]) => {
41+
if (name.endsWith(".wasm")) {
42+
this.files[name] = (await JetStream.getBinary(url)).buffer;
43+
} else {
44+
this.files[name] = await JetStream.getString(url);
45+
}
46+
})
47+
await Promise.all(loadPromises);
48+
}
49+
50+
async runIteration() {
51+
await this.WTBenchmark.runTest(this.files);
52+
}
53+
}

0 commit comments

Comments
 (0)