Skip to content

Commit 9c62b58

Browse files
committed
benchmark(change_detection): added a new set of benchmarks measuring updating properties
1 parent 2560af7 commit 9c62b58

File tree

3 files changed

+232
-88
lines changed

3 files changed

+232
-88
lines changed

modules/benchmarks/e2e_test/change_detection_perf.es6

Lines changed: 54 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ describe('ng2 change detection benchmark', function () {
66

77
afterEach(perfUtil.verifyNoBrowserErrors);
88

9-
it('should log ng stats (dynamic)', function(done) {
9+
it('should log ng stats (dynamic, reads)', function(done) {
1010
perfUtil.runClickBenchmark({
1111
url: URL,
12-
buttons: ['#ng2ChangeDetectionDynamic'],
13-
id: 'ng2.changeDetection.dynamic',
12+
buttons: ['#ng2ChangeDetectionDynamicReads'],
13+
id: 'ng2.changeDetection.dynamic.reads',
1414
params: [
1515
{name: 'numberOfChecks', value: 900000},
1616
{name: 'iterations', value: 20, scale: 'linear'}
@@ -21,11 +21,11 @@ describe('ng2 change detection benchmark', function () {
2121
}).then(done, done.fail);
2222
});
2323

24-
it('should log ng stats (jit)', function(done) {
24+
it('should log ng stats (dynamic, writes)', function(done) {
2525
perfUtil.runClickBenchmark({
2626
url: URL,
27-
buttons: ['#ng2ChangeDetectionJit'],
28-
id: 'ng2.changeDetection.jit',
27+
buttons: ['#ng2ChangeDetectionDynamicWrites'],
28+
id: 'ng2.changeDetection.dynamic.writes',
2929
params: [
3030
{name: 'numberOfChecks', value: 900000},
3131
{name: 'iterations', value: 20, scale: 'linear'}
@@ -36,11 +36,56 @@ describe('ng2 change detection benchmark', function () {
3636
}).then(done, done.fail);
3737
});
3838

39-
it('should log baseline stats', function(done) {
39+
it('should log ng stats (jit, reads)', function(done) {
4040
perfUtil.runClickBenchmark({
4141
url: URL,
42-
buttons: ['#baselineChangeDetection'],
43-
id: 'baseline.changeDetection',
42+
buttons: ['#ng2ChangeDetectionJitReads'],
43+
id: 'ng2.changeDetection.jit.reads',
44+
params: [
45+
{name: 'numberOfChecks', value: 900000},
46+
{name: 'iterations', value: 20, scale: 'linear'}
47+
],
48+
microMetrics: {
49+
'detectChangesAvg': 'avg time to detect changes (ms)'
50+
}
51+
}).then(done, done.fail);
52+
});
53+
54+
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: {
64+
'detectChangesAvg': 'avg time to detect changes (ms)'
65+
}
66+
}).then(done, done.fail);
67+
});
68+
69+
it('should log baseline stats (create)', function(done) {
70+
perfUtil.runClickBenchmark({
71+
url: URL,
72+
buttons: ['#baselineChangeDetectionReads'],
73+
id: 'baseline.changeDetection.reads',
74+
params: [
75+
{name: 'numberOfChecks', value: 900000},
76+
{name: 'iterations', value: 20, scale: 'linear'}
77+
],
78+
microMetrics: {
79+
'detectChangesAvg': 'avg time to detect changes (ms)'
80+
}
81+
}).then(done, done.fail);
82+
});
83+
84+
it('should log baseline stats (update)', function(done) {
85+
perfUtil.runClickBenchmark({
86+
url: URL,
87+
buttons: ['#baselineChangeDetectionWrites'],
88+
id: 'baseline.changeDetection.writes',
4489
params: [
4590
{name: 'numberOfChecks', value: 900000},
4691
{name: 'iterations', value: 20, scale: 'linear'}

modules/benchmarks/src/change_detection/change_detection_benchmark.html

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,14 @@ <h2>Params</h2>
1414

1515
<h2>Actions</h2>
1616
<p>
17-
<button id="ng2ChangeDetectionDynamic">Ng2 detect changes (dynamic)</button>
18-
<button id="ng2ChangeDetectionJit">Ng2 detect changes (jit)</button>
19-
<button id="baselineChangeDetection">baselineDetectChanges</button>
17+
<button id="ng2ChangeDetectionDynamicReads">Ng2 detect changes (reads, dynamic)</button>
18+
<button id="ng2ChangeDetectionDynamicWrites">Ng2 detect changes (writes, dynamic)</button>
19+
20+
<button id="ng2ChangeDetectionJitReads">Ng2 detect changes (reads, jit)</button>
21+
<button id="ng2ChangeDetectionJitWrites">Ng2 detect changes (writes, jit)</button>
22+
23+
<button id="baselineChangeDetectionReads">baselineDetectChangesReads</button>
24+
<button id="baselineChangeDetectionWrites">baselineDetectChangesWrites</button>
2025
</p>
2126

2227
$SCRIPTS$

0 commit comments

Comments
 (0)