File tree 6 files changed +51
-42
lines changed
modules/benchmarks/src/expanding_rows
6 files changed +51
-42
lines changed Original file line number Diff line number Diff line change 1
1
package (default_visibility = ["//modules/benchmarks:__subpackages__" ])
2
2
3
+ load ("//tools:defaults.bzl" , "ts_library" )
3
4
load ("//tools:defaults.bzl" , "ng_module" , "ng_rollup_bundle" )
4
5
load ("@npm_bazel_typescript//:index.bzl" , "ts_devserver" )
5
6
load ("//modules/benchmarks:benchmark_test.bzl" , "benchmark_test" )
@@ -8,7 +9,7 @@ ng_module(
8
9
name = "application_lib" ,
9
10
srcs = glob (
10
11
["**/*.ts" ],
11
- exclude = ["**/*_spec .ts" ],
12
+ exclude = ["**/*.spec .ts" ],
12
13
),
13
14
deps = [
14
15
"//packages:types" ,
@@ -19,14 +20,13 @@ ng_module(
19
20
],
20
21
)
21
22
22
- ng_module (
23
- name = "application_spec" ,
24
- srcs = glob (["**/*_spec.ts" ]),
23
+ ts_library (
24
+ name = "perf_lib" ,
25
+ testonly = 1 ,
26
+ srcs = ["benchmark_perf.spec.ts" ],
25
27
deps = [
26
- "//packages:types" ,
27
- "//packages/common" ,
28
- "//packages/core" ,
29
- "@npm//reflect-metadata" ,
28
+ "//modules/e2e_util" ,
29
+ "@npm//protractor" ,
30
30
],
31
31
)
32
32
@@ -69,6 +69,6 @@ benchmark_test(
69
69
name = "perf" ,
70
70
server = ":prodserver" ,
71
71
deps = [
72
- ":application_spec " ,
72
+ ":perf_lib " ,
73
73
],
74
74
)
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ import {BenchmarkableExpandingRowModule} from './benchmarkable_expanding_row_mod
22
22
23
23
<section>
24
24
<button id="reset" (click)="reset()">Reset</button>
25
- <button (click)="handleInitClick ()">Init</button>
25
+ <button id="init" (click)="init ()">Init</button>
26
26
<button id="run" (click)="runAll()">Run All</button>
27
27
</section>
28
28
@@ -38,6 +38,8 @@ export class InitializationRoot implements AfterViewInit {
38
38
39
39
reset ( ) { this . expandingRow . reset ( ) ; }
40
40
41
+ init ( ) { this . expandingRow . init ( ) ; }
42
+
41
43
async runAll ( ) {
42
44
await execTimed ( 'initialization_benchmark' , async ( ) => { await this . doInit ( ) ; } ) ;
43
45
}
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @license
3
+ * Copyright Google Inc. All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
8
+
9
+ import { $ , browser } from 'protractor' ;
10
+ import { runBenchmark } from '../../../e2e_util/perf_util' ;
11
+
12
+ describe ( 'benchmarks' , ( ) => {
13
+
14
+ it ( 'should work for create' , done => {
15
+ browser . rootEl = '#root' ;
16
+ runBenchmark ( {
17
+ id : 'create' ,
18
+ url : '' ,
19
+ ignoreBrowserSynchronization : true ,
20
+ params : [ ] ,
21
+ prepare : ( ) => $ ( '#reset' ) . click ( ) ,
22
+ work : ( ) => $ ( '#init' ) . click ( )
23
+ } ) . then ( done , done . fail ) ;
24
+ } ) ;
25
+
26
+ } ) ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -14,19 +14,24 @@ <h1>Change Detection Benchmark</h1>
14
14
< benchmark-root > loading...</ benchmark-root >
15
15
16
16
< script >
17
+ window . ngDevMode = location . hash == '#ngDevMode' ;
17
18
addEventListener ( 'DOMContentLoaded' , ( ) => {
18
- window . ngDevMode = location . hash == '#ngDevMode' ;
19
19
// DevServer has automatic bootstrap code, so if we already have <scripts> than we don't need to bootstrap
20
20
var alreadyBootstraped = document . querySelectorAll ( 'script' ) . length > 1 ; // 1 for ourselves
21
-
22
21
if ( ! alreadyBootstraped ) {
23
22
function loadScript ( url ) {
24
- var script = document . createElement ( 'script' ) ;
25
- script . src = url ;
26
- document . body . append ( script ) ;
23
+ return new Promise ( function ( resolve , reject ) {
24
+ var script = document . createElement ( 'script' ) ;
25
+ script . src = url ;
26
+ script . onload = resolve ;
27
+ script . onerror = reject ;
28
+ document . body . append ( script ) ;
29
+ } ) ;
27
30
}
28
- loadScript ( '/npm/node_modules/zone.js/dist/zone.js' ) ;
29
- loadScript ( document . location . search . endsWith ( 'debug' ) ? 'bundle.min_debug.js' : 'bundle.min.js' ) ;
31
+ // zone.js must be loaded and processed before Angular bundle gets executed
32
+ loadScript ( '/npm/node_modules/zone.js/dist/zone.js' ) . then ( function ( ) {
33
+ loadScript ( document . location . search . endsWith ( 'debug' ) ? 'bundle.min_debug.js' : 'bundle.min.js' ) ;
34
+ } ) ;
30
35
}
31
36
} ) ;
32
37
</ script >
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ exports.config = {
34
34
framework : 'jasmine2' ,
35
35
jasmineNodeOpts : {
36
36
showColors : true ,
37
- defaultTimeoutInterval : 60000 ,
37
+ defaultTimeoutInterval : 90000 ,
38
38
print : function ( msg ) { console . log ( msg ) ; } ,
39
39
} ,
40
40
useAllAngular2AppRoots : true
You can’t perform that action at this time.
0 commit comments