Skip to content

Commit d02c0ac

Browse files
committed
refactor(benchmarks): add cloud reporter, add params
- adds console and cloud reporter (via Google BigQuery). - makes parameters of tests explicit and modifiable. - removes `detect` and `ignoreGc` mode from benchpress as these can result in unstable numbers.
1 parent af02f2b commit d02c0ac

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+979
-597
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,7 @@ pubspec.lock
1919
.idea/
2020
*.swo
2121

22+
# Don't check in secret files
23+
*secret.js
2224

2325
/docs/bower_components/

gulpfile.js

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ var _HTLM_DEFAULT_SCRIPTS_JS = [
5454
}
5555
];
5656

57+
var _HTML_DEFAULT_SCRIPTS_DART = [
58+
{src: '$MODULENAME_WITHOUT_PATH$.dart', mimeType: 'application/dart'},
59+
{src: 'packages/browser/dart.js', mimeType: 'text/javascript'}
60+
];
5761

5862
var CONFIG = {
5963
dest: {
@@ -72,7 +76,8 @@ var CONFIG = {
7276
},
7377
srcFolderMapping: {
7478
'default': 'lib',
75-
'**/benchmark*/**': 'web',
79+
'**/benchmarks/**': 'web',
80+
'**/benchmarks_external/**': 'web',
7681
'**/example*/**': 'web'
7782
},
7883
deps: {
@@ -83,8 +88,12 @@ var CONFIG = {
8388
"node_modules/systemjs/lib/extension-register.js",
8489
"node_modules/zone.js/zone.js",
8590
"node_modules/zone.js/long-stack-trace-zone.js",
86-
"tools/build/runtime_paths.js",
91+
"tools/build/snippets/runtime_paths.js",
92+
"tools/build/snippets/url_params_to_form.js",
8793
"node_modules/angular/angular.js"
94+
],
95+
dart: [
96+
"tools/build/snippets/url_params_to_form.js"
8897
]
8998
},
9099
transpile: {
@@ -133,14 +142,22 @@ var CONFIG = {
133142
scriptsPerFolder: {
134143
js: {
135144
default: _HTLM_DEFAULT_SCRIPTS_JS,
145+
'benchmarks/**':
146+
[
147+
{ src: '/deps/url_params_to_form.js', mimeType: 'text/javascript' }
148+
].concat(_HTLM_DEFAULT_SCRIPTS_JS),
136149
'benchmarks_external/**':
137-
[{ src: '/deps/angular.js', mimeType: 'text/javascript' }].concat(_HTLM_DEFAULT_SCRIPTS_JS)
150+
[
151+
{ src: '/deps/angular.js', mimeType: 'text/javascript' },
152+
{ src: '/deps/url_params_to_form.js', mimeType: 'text/javascript' }
153+
].concat(_HTLM_DEFAULT_SCRIPTS_JS)
138154
},
139155
dart: {
140-
default: [
141-
{src: '$MODULENAME_WITHOUT_PATH$.dart', mimeType: 'application/dart'},
142-
{src: 'packages/browser/dart.js', mimeType: 'text/javascript'}
143-
]
156+
default: _HTML_DEFAULT_SCRIPTS_DART,
157+
'benchmarks*/**':
158+
[
159+
{ src: '/deps/url_params_to_form.js', mimeType: 'text/javascript' }
160+
].concat(_HTML_DEFAULT_SCRIPTS_DART)
144161
}
145162
}
146163
},
@@ -178,6 +195,11 @@ gulp.task('build/deps.js.prod', deps(gulp, gulpPlugins, {
178195
dest: CONFIG.dest.js.prod
179196
}));
180197

198+
gulp.task('build/deps.js.dart2js', deps(gulp, gulpPlugins, {
199+
src: CONFIG.deps.dart,
200+
dest: CONFIG.dest.js.dart2js
201+
}));
202+
181203
// ------------
182204
// transpile
183205

@@ -373,7 +395,7 @@ gulp.task('docs/serve', function() {
373395
// orchestrated targets
374396
gulp.task('build.dart', function() {
375397
return runSequence(
376-
['build/transpile.dart', 'build/html.dart'],
398+
['build/deps.js.dart2js', 'build/transpile.dart', 'build/html.dart'],
377399
'build/pubspec.dart',
378400
'build/pubbuild.dart',
379401
'build/analyze.dart'
Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,31 @@
1-
"use strict";
2-
var benchpress = require('../../../tools/benchpress/index.js');
1+
var perfUtil = require('../../e2e_test_lib/e2e_test/perf_util');
32

43
describe('ng2 change detection benchmark', function () {
54

65
var URL = 'benchmarks/web/change_detection/change_detection_benchmark.html';
76

8-
afterEach(benchpress.verifyNoBrowserErrors);
7+
afterEach(perfUtil.verifyNoBrowserErrors);
98

109
it('should log ng stats', function() {
11-
browser.get(URL);
12-
runClickBenchmark({
10+
perfUtil.runClickBenchmark({
11+
url: URL,
1312
buttons: ['#ng2DetectChanges'],
14-
logId: 'ng2.changeDetection'
13+
id: 'ng2.changeDetection',
14+
params: [{
15+
name: 'iterations', value: 500000
16+
}]
1517
});
1618
});
1719

1820
it('should log baseline stats', function() {
19-
browser.get(URL);
20-
runClickBenchmark({
21+
perfUtil.runClickBenchmark({
22+
url: URL,
2123
buttons: ['#baselineDetectChanges'],
22-
logId: 'baseline.changeDetection'
24+
id: 'baseline.changeDetection',
25+
params: [{
26+
name: 'iterations', value: 500000
27+
}]
2328
});
2429
});
2530

2631
});
27-
28-
function runClickBenchmark(config) {
29-
var buttons = config.buttons.map(function(selector) {
30-
return $(selector);
31-
});
32-
var params = Object.create(browser.params.benchmark);
33-
params.logId = browser.params.lang+'.'+config.logId;
34-
benchpress.runBenchmark(params, function() {
35-
buttons.forEach(function(button) {
36-
button.click();
37-
});
38-
});
39-
}
Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
1-
var benchpress = require('../../../tools/benchpress/index.js');
1+
var testUtil = require('../../e2e_test_lib/e2e_test/test_util');
22

33
describe('ng2 change detection benchmark', function () {
44

55
var URL = 'benchmarks/web/change_detection/change_detection_benchmark.html';
66

7-
afterEach(benchpress.verifyNoBrowserErrors);
7+
afterEach(testUtil.verifyNoBrowserErrors);
88

99
it('should not throw errors', function() {
1010
browser.get(URL);
11-
clickAll(['#ng2DetectChanges', '#baselineDetectChanges']);
11+
testUtil.clickAll(['#ng2DetectChanges', '#baselineDetectChanges']);
1212
});
1313

1414
});
15-
16-
function clickAll(buttonSelectors) {
17-
buttonSelectors.forEach(function(selector) {
18-
$(selector).click();
19-
});
20-
}
Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,31 @@
1-
"use strict";
2-
var benchpress = require('../../../tools/benchpress/index.js');
1+
var perfUtil = require('../../e2e_test_lib/e2e_test/perf_util');
32

43
describe('ng2 compiler benchmark', function () {
54

65
var URL = 'benchmarks/web/compiler/compiler_benchmark.html';
76

8-
afterEach(benchpress.verifyNoBrowserErrors);
7+
afterEach(perfUtil.verifyNoBrowserErrors);
98

109
it('should log withBindings stats', function() {
11-
browser.get(URL);
12-
runClickBenchmark({
10+
perfUtil.runClickBenchmark({
11+
url: URL,
1312
buttons: ['#compileWithBindings'],
14-
logId: 'ng2.compile.withBindings'
13+
id: 'ng2.compile.withBindings',
14+
params: [{
15+
name: 'elementCount', selector: '#elementCount', value: 150
16+
}]
1517
});
1618
});
1719

1820
it('should log noBindings stats', function() {
19-
browser.get(URL);
20-
runClickBenchmark({
21+
perfUtil.runClickBenchmark({
22+
url: URL,
2123
buttons: ['#compileNoBindings'],
22-
logId: 'ng2.compile.noBindings'
24+
id: 'ng2.compile.noBindings',
25+
params: [{
26+
name: 'elementCount', value: 150
27+
}]
2328
});
2429
});
2530

2631
});
27-
28-
function runClickBenchmark(config) {
29-
var buttons = config.buttons.map(function(selector) {
30-
return $(selector);
31-
});
32-
var params = Object.create(browser.params.benchmark);
33-
params.logId = browser.params.lang+'.'+config.logId;
34-
benchpress.runBenchmark(params, function() {
35-
buttons.forEach(function(button) {
36-
button.click();
37-
});
38-
});
39-
}
Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
1-
"use strict";
2-
var benchpress = require('../../../tools/benchpress/index.js');
1+
var testUtil = require('../../e2e_test_lib/e2e_test/test_util');
32

43
describe('ng2 compiler benchmark', function () {
54

65
var URL = 'benchmarks/web/compiler/compiler_benchmark.html';
76

8-
afterEach(benchpress.verifyNoBrowserErrors);
7+
afterEach(testUtil.verifyNoBrowserErrors);
98

109
it('should not throw errors', function() {
1110
browser.get(URL);
12-
clickAll(['#compileWithBindings', '#compileNoBindings']);
11+
testUtil.clickAll(['#compileWithBindings', '#compileNoBindings']);
1312
});
1413

1514
});
16-
17-
function clickAll(buttonSelectors) {
18-
buttonSelectors.forEach(function(selector) {
19-
$(selector).click();
20-
});
21-
}
Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,53 @@
1-
"use strict";
2-
var benchpress = require('../../../tools/benchpress/index.js');
1+
var perfUtil = require('../../e2e_test_lib/e2e_test/perf_util');
32

43
describe('ng2 di benchmark', function () {
54

65
var URL = 'benchmarks/web/di/di_benchmark.html';
76

8-
afterEach(benchpress.verifyNoBrowserErrors);
7+
afterEach(perfUtil.verifyNoBrowserErrors);
98

109
it('should log the stats for getByToken', function() {
11-
browser.get(URL);
12-
runClickBenchmark({
10+
perfUtil.runClickBenchmark({
11+
url: URL,
1312
buttons: ['#getByToken'],
14-
logId: 'ng2.di.getByToken'
13+
id: 'ng2.di.getByToken',
14+
params: [{
15+
name: 'iterations', value: 20000
16+
}]
1517
});
1618
});
1719

1820
it('should log the stats for getByKey', function() {
19-
browser.get(URL);
20-
runClickBenchmark({
21+
perfUtil.runClickBenchmark({
22+
url: URL,
2123
buttons: ['#getByKey'],
22-
logId: 'ng2.di.getByKey'
24+
id: 'ng2.di.getByKey',
25+
params: [{
26+
name: 'iterations', value: 20000
27+
}]
2328
});
2429
});
2530

2631
it('should log the stats for getChild', function() {
27-
browser.get(URL);
28-
runClickBenchmark({
32+
perfUtil.runClickBenchmark({
33+
url: URL,
2934
buttons: ['#getChild'],
30-
logId: 'ng2.di.getChild'
35+
id: 'ng2.di.getChild',
36+
params: [{
37+
name: 'iterations', value: 20000
38+
}]
3139
});
3240
});
3341

3442
it('should log the stats for instantiate', function() {
35-
browser.get(URL);
36-
runClickBenchmark({
43+
perfUtil.runClickBenchmark({
44+
url: URL,
3745
buttons: ['#instantiate'],
38-
logId: 'ng2.di.instantiate'
46+
id: 'ng2.di.instantiate',
47+
params: [{
48+
name: 'iterations', value: 10000
49+
}]
3950
});
4051
});
4152

4253
});
43-
44-
function runClickBenchmark(config) {
45-
var buttons = config.buttons.map(function(selector) {
46-
return $(selector);
47-
});
48-
var params = Object.create(browser.params.benchmark);
49-
params.logId = browser.params.lang+'.'+config.logId;
50-
benchpress.runBenchmark(params, function() {
51-
buttons.forEach(function(button) {
52-
button.click();
53-
});
54-
});
55-
}
Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
1-
var benchpress = require('../../../tools/benchpress/index.js');
1+
var testUtil = require('../../e2e_test_lib/e2e_test/test_util');
22

33
describe('ng2 di benchmark', function () {
44

55
var URL = 'benchmarks/web/di/di_benchmark.html';
66

7-
afterEach(benchpress.verifyNoBrowserErrors);
7+
afterEach(testUtil.verifyNoBrowserErrors);
88

99
it('should not throw errors', function() {
1010
browser.get(URL);
11-
clickAll(['#getByToken', '#getByKey', '#getChild', '#instantiate']);
11+
testUtil.clickAll(['#getByToken', '#getByKey', '#getChild', '#instantiate']);
1212
});
1313

1414
});
15-
16-
function clickAll(buttonSelectors) {
17-
buttonSelectors.forEach(function(selector) {
18-
$(selector).click();
19-
});
20-
}

0 commit comments

Comments
 (0)