forked from angular/angular
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdi_perf.ts
More file actions
82 lines (72 loc) · 2.65 KB
/
di_perf.ts
File metadata and controls
82 lines (72 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import {runClickBenchmark, verifyNoBrowserErrors} from 'angular2/src/testing/perf_util';
describe('ng2 di benchmark', function() {
var URL = 'benchmarks/src/di/di_benchmark.html';
afterEach(verifyNoBrowserErrors);
it('should log the stats for getByToken', function(done) {
runClickBenchmark({
url: URL,
buttons: ['#getByToken'],
id: 'ng2.di.getByToken',
params: [{name: 'iterations', value: 20000, scale: 'linear'}],
microMetrics: {'injectAvg': 'avg time for injection (in ms)'},
waitForAngular2: false
}).then(done, done.fail);
});
it('should log the stats for getByKey', function(done) {
runClickBenchmark({
url: URL,
buttons: ['#getByKey'],
id: 'ng2.di.getByKey',
params: [{name: 'iterations', value: 20000, scale: 'linear'}],
microMetrics: {'injectAvg': 'avg time for injection (in ms)'},
waitForAngular2: false
}).then(done, done.fail);
});
it('should log the stats for getChild', function(done) {
runClickBenchmark({
url: URL,
buttons: ['#getChild'],
id: 'ng2.di.getChild',
params: [{name: 'iterations', value: 20000, scale: 'linear'}],
microMetrics: {'injectAvg': 'avg time for getChild (in ms)'},
waitForAngular2: false
}).then(done, done.fail);
});
it('should log the stats for instantiate', function(done) {
runClickBenchmark({
url: URL,
buttons: ['#instantiate'],
id: 'ng2.di.instantiate',
params: [{name: 'iterations', value: 10000, scale: 'linear'}],
microMetrics: {'injectAvg': 'avg time for instantiate (in ms)'},
waitForAngular2: false
}).then(done, done.fail);
});
/**
* This benchmark measures the cost of creating a new injector with a mix
* of binding types: Type, unresolved, unflattened.
*/
it('should log the stats for createVariety', function(done) {
runClickBenchmark({
url: URL,
buttons: ['#createVariety'],
id: 'ng2.di.createVariety',
params: [{name: 'iterations', value: 10000, scale: 'linear'}],
microMetrics: {'injectAvg': 'avg time for createVariety (in ms)'},
waitForAngular2: false
}).then(done, done.fail);
});
/**
* Same as 'createVariety' benchmark but operates on fully resolved bindings.
*/
it('should log the stats for createVarietyResolved', function(done) {
runClickBenchmark({
url: URL,
buttons: ['#createVarietyResolved'],
id: 'ng2.di.createVarietyResolved',
params: [{name: 'iterations', value: 10000, scale: 'linear'}],
microMetrics: {'injectAvg': 'avg time for createVarietyResolved (in ms)'},
waitForAngular2: false
}).then(done, done.fail);
});
});