feat(benchpress): create component_benchmark macro (#35692)
* Create component_benchmark macro * Change class_bindings benchmark to use component_benchmark PR Close #35692
This commit is contained in:

committed by
Misko Hevery

parent
df890d7629
commit
8968b206b4
@ -1,56 +1,31 @@
|
||||
package(default_visibility = ["//modules/benchmarks:__subpackages__"])
|
||||
|
||||
load("//tools:defaults.bzl", "ng_module", "ng_rollup_bundle", "ts_devserver", "ts_library")
|
||||
load("//modules/benchmarks:benchmark_test.bzl", "benchmark_test")
|
||||
load("@io_bazel_rules_sass//sass:sass.bzl", "sass_binary")
|
||||
load("//tools/components:component_benchmark.bzl", "component_benchmark")
|
||||
|
||||
ng_module(
|
||||
name = "application_lib",
|
||||
srcs = glob(
|
||||
["**/*.ts"],
|
||||
exclude = ["**/*.perf-spec.ts"],
|
||||
),
|
||||
generate_ve_shims = True,
|
||||
deps = [
|
||||
sass_binary(
|
||||
name = "class_bindings_styles",
|
||||
src = ":styles.scss",
|
||||
)
|
||||
|
||||
component_benchmark(
|
||||
name = "benchmark",
|
||||
driver = ":class_bindings.perf-spec.ts",
|
||||
driver_deps = [
|
||||
"//modules/e2e_util",
|
||||
"@npm//protractor",
|
||||
],
|
||||
ng_deps = [
|
||||
"//packages:types",
|
||||
"//packages/common",
|
||||
"//packages/core",
|
||||
"//packages/platform-browser",
|
||||
"@npm//rxjs",
|
||||
],
|
||||
)
|
||||
|
||||
ts_library(
|
||||
name = "perf_lib",
|
||||
testonly = 1,
|
||||
srcs = ["class_bindings.perf-spec.ts"],
|
||||
tsconfig = "//modules/benchmarks:tsconfig-e2e.json",
|
||||
deps = [
|
||||
"//modules/e2e_util",
|
||||
"@npm//protractor",
|
||||
],
|
||||
)
|
||||
|
||||
ng_rollup_bundle(
|
||||
name = "bundle",
|
||||
entry_point = ":index_aot.ts",
|
||||
deps = [
|
||||
":application_lib",
|
||||
"@npm//rxjs",
|
||||
],
|
||||
)
|
||||
|
||||
ts_devserver(
|
||||
name = "prodserver",
|
||||
bootstrap = ["//packages/zone.js/dist:zone.js"],
|
||||
port = 4200,
|
||||
static_files = ["index.html"],
|
||||
deps = [":bundle.min_debug.es2015.js"],
|
||||
)
|
||||
|
||||
benchmark_test(
|
||||
name = "perf",
|
||||
server = ":prodserver",
|
||||
deps = [
|
||||
":perf_lib",
|
||||
],
|
||||
ng_srcs = glob(
|
||||
["**/*.ts"],
|
||||
exclude = ["**/*.perf-spec.ts"],
|
||||
),
|
||||
prefix = "",
|
||||
styles = [":class_bindings_styles"],
|
||||
)
|
||||
|
@ -8,7 +8,7 @@
|
||||
import {Component} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-component',
|
||||
selector: 'app-root',
|
||||
template: `
|
||||
<button id="create" (click)="create()">Create</button>
|
||||
<button id="update" (click)="update()">Update</button>
|
||||
@ -35,4 +35,4 @@ export class AppComponent {
|
||||
}
|
||||
|
||||
destroy() { this.show = false; }
|
||||
}
|
||||
}
|
||||
|
@ -1,27 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<!-- Prevent the browser from requesting any favicon. -->
|
||||
<link rel="icon" href="data:,">
|
||||
<style>
|
||||
.hello {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.bye {
|
||||
color: blue;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Class Binding Benchmark</h1>
|
||||
<app-component>Loading...</app-component>
|
||||
|
||||
<!--load location for ts_devserver-->
|
||||
<script src="/app_bundle.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -1,15 +0,0 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import {enableProdMode} from '@angular/core';
|
||||
import {platformBrowser} from '@angular/platform-browser';
|
||||
|
||||
import {AppModuleNgFactory} from './app.module.ngfactory';
|
||||
|
||||
enableProdMode();
|
||||
|
||||
platformBrowser().bootstrapModuleFactory(AppModuleNgFactory);
|
7
modules/benchmarks/src/class_bindings/styles.scss
Normal file
7
modules/benchmarks/src/class_bindings/styles.scss
Normal file
@ -0,0 +1,7 @@
|
||||
.hello {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.bye {
|
||||
color: blue;
|
||||
}
|
Reference in New Issue
Block a user