|
1 | | -/// <reference path="../../angular2/typings/node/node.d.ts" /> |
2 | | -import {afterEach, describe, it} from 'angular2/test_lib'; |
3 | | - |
4 | | -var perfUtil = require('angular2/src/test_lib/perf_util'); |
| 1 | +import {runClickBenchmark, verifyNoBrowserErrors} from 'angular2/src/test_lib/perf_util'; |
5 | 2 |
|
6 | 3 | describe('ng2 change detection benchmark', function() { |
7 | 4 |
|
8 | 5 | var URL = 'benchmarks/src/change_detection/change_detection_benchmark.html'; |
9 | 6 |
|
10 | | - afterEach(perfUtil.verifyNoBrowserErrors); |
| 7 | + afterEach(verifyNoBrowserErrors); |
11 | 8 |
|
12 | 9 | it('should log ng stats (dynamic, reads)', function(done) { |
13 | | - perfUtil.runClickBenchmark({ |
14 | | - url: URL, |
15 | | - buttons: ['#ng2ChangeDetectionDynamicReads'], |
16 | | - id: 'ng2.changeDetection.dynamic.reads', |
17 | | - params: [ |
18 | | - {name: 'numberOfChecks', value: 900000}, |
19 | | - {name: 'iterations', value: 20, scale: 'linear'} |
20 | | - ], |
21 | | - microMetrics: {'detectChangesAvg': 'avg time to detect changes (ms)'} |
22 | | - }) |
23 | | - .then(done, done.fail); |
| 10 | + runClickBenchmark({ |
| 11 | + url: URL, |
| 12 | + buttons: ['#ng2ChangeDetectionDynamicReads'], |
| 13 | + id: 'ng2.changeDetection.dynamic.reads', |
| 14 | + params: [ |
| 15 | + {name: 'numberOfChecks', value: 900000}, |
| 16 | + {name: 'iterations', value: 20, scale: 'linear'} |
| 17 | + ], |
| 18 | + microMetrics: {'detectChangesAvg': 'avg time to detect changes (ms)'} |
| 19 | + }).then(done, done.fail); |
24 | 20 | }); |
25 | 21 |
|
26 | 22 | it('should log ng stats (dynamic, writes)', function(done) { |
27 | | - perfUtil.runClickBenchmark({ |
28 | | - url: URL, |
29 | | - buttons: ['#ng2ChangeDetectionDynamicWrites'], |
30 | | - id: 'ng2.changeDetection.dynamic.writes', |
31 | | - params: [ |
32 | | - {name: 'numberOfChecks', value: 900000}, |
33 | | - {name: 'iterations', value: 20, scale: 'linear'} |
34 | | - ], |
35 | | - microMetrics: {'detectChangesAvg': 'avg time to detect changes (ms)'} |
36 | | - }) |
37 | | - .then(done, done.fail); |
| 23 | + runClickBenchmark({ |
| 24 | + url: URL, |
| 25 | + buttons: ['#ng2ChangeDetectionDynamicWrites'], |
| 26 | + id: 'ng2.changeDetection.dynamic.writes', |
| 27 | + params: [ |
| 28 | + {name: 'numberOfChecks', value: 900000}, |
| 29 | + {name: 'iterations', value: 20, scale: 'linear'} |
| 30 | + ], |
| 31 | + microMetrics: {'detectChangesAvg': 'avg time to detect changes (ms)'} |
| 32 | + }).then(done, done.fail); |
38 | 33 | }); |
39 | 34 |
|
40 | 35 | it('should log ng stats (jit, reads)', function(done) { |
41 | | - perfUtil.runClickBenchmark({ |
42 | | - url: URL, |
43 | | - buttons: ['#ng2ChangeDetectionJitReads'], |
44 | | - id: 'ng2.changeDetection.jit.reads', |
45 | | - params: [ |
46 | | - {name: 'numberOfChecks', value: 900000}, |
47 | | - {name: 'iterations', value: 20, scale: 'linear'} |
48 | | - ], |
49 | | - microMetrics: {'detectChangesAvg': 'avg time to detect changes (ms)'} |
50 | | - }) |
51 | | - .then(done, done.fail); |
| 36 | + runClickBenchmark({ |
| 37 | + url: URL, |
| 38 | + buttons: ['#ng2ChangeDetectionJitReads'], |
| 39 | + id: 'ng2.changeDetection.jit.reads', |
| 40 | + params: [ |
| 41 | + {name: 'numberOfChecks', value: 900000}, |
| 42 | + {name: 'iterations', value: 20, scale: 'linear'} |
| 43 | + ], |
| 44 | + microMetrics: {'detectChangesAvg': 'avg time to detect changes (ms)'} |
| 45 | + }).then(done, done.fail); |
52 | 46 | }); |
53 | 47 |
|
54 | 48 | it('should log ng stats (jit, writes)', function(done) { |
55 | | - perfUtil.runClickBenchmark({ |
56 | | - url: URL, |
57 | | - buttons: ['#ng2ChangeDetectionJitWrites'], |
58 | | - id: 'ng2.changeDetection.jit.writes', |
59 | | - params: [ |
60 | | - {name: 'numberOfChecks', value: 900000}, |
61 | | - {name: 'iterations', value: 20, scale: 'linear'} |
62 | | - ], |
63 | | - microMetrics: {'detectChangesAvg': 'avg time to detect changes (ms)'} |
64 | | - }) |
65 | | - .then(done, done.fail); |
| 49 | + runClickBenchmark({ |
| 50 | + url: URL, |
| 51 | + buttons: ['#ng2ChangeDetectionJitWrites'], |
| 52 | + id: 'ng2.changeDetection.jit.writes', |
| 53 | + params: [ |
| 54 | + {name: 'numberOfChecks', value: 900000}, |
| 55 | + {name: 'iterations', value: 20, scale: 'linear'} |
| 56 | + ], |
| 57 | + microMetrics: {'detectChangesAvg': 'avg time to detect changes (ms)'} |
| 58 | + }).then(done, done.fail); |
66 | 59 | }); |
67 | 60 |
|
68 | 61 | it('should log baseline stats (create)', function(done) { |
69 | | - perfUtil.runClickBenchmark({ |
70 | | - url: URL, |
71 | | - buttons: ['#baselineChangeDetectionReads'], |
72 | | - id: 'baseline.changeDetection.reads', |
73 | | - params: [ |
74 | | - {name: 'numberOfChecks', value: 900000}, |
75 | | - {name: 'iterations', value: 20, scale: 'linear'} |
76 | | - ], |
77 | | - microMetrics: {'detectChangesAvg': 'avg time to detect changes (ms)'} |
78 | | - }) |
79 | | - .then(done, done.fail); |
| 62 | + runClickBenchmark({ |
| 63 | + url: URL, |
| 64 | + buttons: ['#baselineChangeDetectionReads'], |
| 65 | + id: 'baseline.changeDetection.reads', |
| 66 | + params: [ |
| 67 | + {name: 'numberOfChecks', value: 900000}, |
| 68 | + {name: 'iterations', value: 20, scale: 'linear'} |
| 69 | + ], |
| 70 | + microMetrics: {'detectChangesAvg': 'avg time to detect changes (ms)'} |
| 71 | + }).then(done, done.fail); |
80 | 72 | }); |
81 | 73 |
|
82 | 74 | it('should log baseline stats (update)', function(done) { |
83 | | - perfUtil.runClickBenchmark({ |
84 | | - url: URL, |
85 | | - buttons: ['#baselineChangeDetectionWrites'], |
86 | | - id: 'baseline.changeDetection.writes', |
87 | | - params: [ |
88 | | - {name: 'numberOfChecks', value: 900000}, |
89 | | - {name: 'iterations', value: 20, scale: 'linear'} |
90 | | - ], |
91 | | - microMetrics: {'detectChangesAvg': 'avg time to detect changes (ms)'} |
92 | | - }) |
93 | | - .then(done, done.fail); |
| 75 | + runClickBenchmark({ |
| 76 | + url: URL, |
| 77 | + buttons: ['#baselineChangeDetectionWrites'], |
| 78 | + id: 'baseline.changeDetection.writes', |
| 79 | + params: [ |
| 80 | + {name: 'numberOfChecks', value: 900000}, |
| 81 | + {name: 'iterations', value: 20, scale: 'linear'} |
| 82 | + ], |
| 83 | + microMetrics: {'detectChangesAvg': 'avg time to detect changes (ms)'} |
| 84 | + }).then(done, done.fail); |
94 | 85 | }); |
95 | 86 |
|
96 | 87 | }); |
0 commit comments