Skip to content

Commit 6f429ae

Browse files
committed
refactor: make benchmarking syncing easier and add comments for future insight (angular#48521)
The way the benchmarking code is used and wired up in g3 is rather magical. This change makes it easier to sync into g3 by using conditional blocks, and also consistnetly using a single bundle name (like it was before— we regressed here as part of the ESM initial changes- but now with clear comments, it's more future-proof..) PR Close angular#48521
1 parent 2e99dfd commit 6f429ae

37 files changed

Lines changed: 194 additions & 23 deletions

File tree

modules/benchmarks/src/change_detection/transplanted_views/BUILD.bazel

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,19 @@ app_bundle(
2727
],
2828
)
2929

30+
# The script needs to be called `app_bundle` for easier syncing into g3.
31+
genrule(
32+
name = "app_bundle",
33+
srcs = [":bundle.debug.min.js"],
34+
outs = ["app_bundle.js"],
35+
cmd = "cp $< $@",
36+
)
37+
3038
http_server(
3139
name = "prodserver",
3240
srcs = ["index.html"],
3341
deps = [
34-
":bundle.debug.min.js",
42+
":app_bundle",
3543
"//packages/zone.js/bundles:zone.umd.js",
3644
],
3745
)

modules/benchmarks/src/change_detection/transplanted_views/index.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ <h2>Render3 Transplanted View Benchmark</h2>
2626
<declaration-component id="root"></declaration-component>
2727
</div>
2828

29+
<!-- BEGIN-EXTERNAL -->
2930
<script src="/angular/packages/zone.js/bundles/zone.umd.js"></script>
30-
<script src="/bundle.debug.min.js"></script>
31+
<!-- END-EXTERNAL -->
32+
33+
<!-- Needs to be named `app_bundle` for sync into Google. -->
34+
<script src="/app_bundle.js"></script>
3135
</body>
3236
</html>

modules/benchmarks/src/expanding_rows/BUILD.bazel

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,19 @@ app_bundle(
4040
],
4141
)
4242

43+
# The script needs to be called `app_bundle` for easier syncing into g3.
44+
genrule(
45+
name = "app_bundle",
46+
srcs = [":bundle.debug.min.js"],
47+
outs = ["app_bundle.js"],
48+
cmd = "cp $< $@",
49+
)
50+
4351
http_server(
4452
name = "prodserver",
4553
srcs = ["index.html"],
4654
deps = [
47-
":bundle.debug.min.js",
55+
":app_bundle",
4856
"//packages/zone.js/bundles:zone.umd.js",
4957
],
5058
)

modules/benchmarks/src/expanding_rows/index.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ <h1>Change Detection Benchmark</h1>
1111

1212
<benchmark-root>Loading...</benchmark-root>
1313

14+
<!-- BEGIN-EXTERNAL -->
1415
<script src="/angular/packages/zone.js/bundles/zone.umd.js"></script>
15-
<script src="/bundle.debug.min.js"></script>
16+
<!-- END-EXTERNAL -->
17+
18+
<!-- Needs to be named `app_bundle` for sync into Google. -->
19+
<script src="/app_bundle.js"></script>
1620
</body>
1721
</html>

modules/benchmarks/src/js-web-frameworks/ng2/BUILD.bazel

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,19 @@ app_bundle(
2424
],
2525
)
2626

27+
# The script needs to be called `app_bundle` for easier syncing into g3.
28+
genrule(
29+
name = "app_bundle",
30+
srcs = [":bundle.debug.min.js"],
31+
outs = ["app_bundle.js"],
32+
cmd = "cp $< $@",
33+
)
34+
2735
http_server(
2836
name = "prodserver",
2937
srcs = ["index.html"],
3038
deps = [
31-
":bundle.debug.min.js",
39+
":app_bundle",
3240
"//packages/zone.js/bundles:zone.umd.js",
3341
],
3442
)

modules/benchmarks/src/js-web-frameworks/ng2/index.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ <h2>
2424
<js-web-frameworks id="root">Loading...</js-web-frameworks>
2525
</div>
2626

27+
<!-- BEGIN-EXTERNAL -->
2728
<script src="/angular/packages/zone.js/bundles/zone.umd.js"></script>
28-
<script src="/bundle.debug.min.js"></script>
29+
<!-- END-EXTERNAL -->
30+
31+
<!-- Needs to be named `app_bundle` for sync into Google. -->
32+
<script src="/app_bundle.js"></script>
2933
</body>
3034
</html>

modules/benchmarks/src/largeform/ng2/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ <h2>Ng2 Large Form Benchmark</h2>
2020
<app id="root">Loading...</app>
2121
</div>
2222

23+
<!-- Needs to be named `app_bundle` for sync into Google. -->
2324
<script src="/app_bundle.js"></script>
2425
</body>
2526
</html>

modules/benchmarks/src/largeform/ng2/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9+
// BEGIN-EXTERNAL
910
import 'zone.js/lib/browser/rollup-main';
1011

12+
// END-EXTERNAL
13+
1114
import {enableProdMode} from '@angular/core';
1215
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
1316

modules/benchmarks/src/largeform/ng2/index_aot.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9+
// BEGIN-EXTERNAL
910
import 'zone.js/lib/browser/rollup-main';
1011

12+
// END-EXTERNAL
13+
1114
import {enableProdMode} from '@angular/core';
1215
import {platformBrowser} from '@angular/platform-browser';
1316

modules/benchmarks/src/largetable/baseline/BUILD.bazel

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,19 @@ ts_library(
1515
)
1616

1717
app_bundle(
18-
name = "app_bundle",
18+
name = "bundle",
1919
entry_point = ":index.ts",
2020
deps = [":baseline"],
2121
)
2222

23+
# The script needs to be called `app_bundle` for easier syncing into g3.
24+
genrule(
25+
name = "app_bundle",
26+
srcs = [":bundle.debug.min.js"],
27+
outs = ["app_bundle.js"],
28+
cmd = "cp $< $@",
29+
)
30+
2331
http_server(
2432
name = "devserver",
2533
srcs = ["index.html"],

0 commit comments

Comments
 (0)