Skip to content

Commit bc10dc3

Browse files
committed
fix(benchmarks): update react and polymer benchmarks and get tree update numbers for all of the benchmarks as well.
Closes #4709
1 parent 5c48236 commit bc10dc3

13 files changed

Lines changed: 169 additions & 85 deletions

File tree

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular2",
33
"dependencies": {
4-
"polymer": "dart-lang/polymer_js#0.8.0-preview"
4+
"polymer": "Polymer/polymer"
55
}
66
}

modules/benchmarks/e2e_test/static_tree_perf.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ describe('ng2 static tree benchmark', function() {
3737
runClickBenchmark({
3838
url: URL,
3939
buttons: ['#baselineDestroyDom', '#baselineCreateDom'],
40-
id: 'baseline.tree.create',
40+
id: 'baseline.static.tree.create',
4141
params: [{name: 'depth', value: 9, scale: 'log2'}]
4242
}).then(done, done.fail);
4343
});
@@ -46,7 +46,7 @@ describe('ng2 static tree benchmark', function() {
4646
runClickBenchmark({
4747
url: URL,
4848
buttons: ['#baselineCreateDom'],
49-
id: 'baseline.tree.update',
49+
id: 'baseline.static.tree.update',
5050
params: [{name: 'depth', value: 9, scale: 'log2'}]
5151
}).then(done, done.fail);
5252
});

modules/benchmarks_external/e2e_test/polymer_tree_perf.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,21 @@ describe('polymer tree benchmark', function() {
66

77
afterEach(verifyNoBrowserErrors);
88

9-
it('should log the stats', function(done) {
9+
it('should log the stats (create)', function(done) {
1010
runClickBenchmark({
1111
url: URL,
1212
buttons: ['#destroyDom', '#createDom'],
13-
id: 'polymer.tree',
13+
id: 'polymer.tree.create',
14+
params: [{name: 'depth', value: 9, scale: 'log2'}],
15+
waitForAngular2: false
16+
}).then(done, done.fail);
17+
});
18+
19+
it('should log the stats (update)', function(done) {
20+
runClickBenchmark({
21+
url: URL,
22+
buttons: ['#createDom'],
23+
id: 'polymer.tree.update',
1424
params: [{name: 'depth', value: 9, scale: 'log2'}],
1525
waitForAngular2: false
1626
}).then(done, done.fail);

modules/benchmarks_external/e2e_test/static_tree_perf.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,21 @@ describe('ng1.x tree benchmark', function() {
66

77
afterEach(verifyNoBrowserErrors);
88

9-
it('should log the stats', function(done) {
9+
it('should log the stats (create)', function(done) {
1010
runClickBenchmark({
1111
url: URL,
1212
buttons: ['#destroyDom', '#createDom'],
13-
id: 'ng1.static.tree',
13+
id: 'ng1.static.tree.create',
14+
params: [],
15+
waitForAngular2: false
16+
}).then(done, done.fail);
17+
});
18+
19+
it('should log the stats (update)', function(done) {
20+
runClickBenchmark({
21+
url: URL,
22+
buttons: ['#createDom'],
23+
id: 'ng1.static.tree.update',
1424
params: [],
1525
waitForAngular2: false
1626
}).then(done, done.fail);

modules/benchmarks_external/e2e_test/tree_perf.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,21 @@ describe('ng1.x tree benchmark', function() {
66

77
afterEach(verifyNoBrowserErrors);
88

9-
it('should log the stats', function(done) {
9+
it('should log the stats (create)', function(done) {
1010
runClickBenchmark({
1111
url: URL,
1212
buttons: ['#destroyDom', '#createDom'],
13-
id: 'ng1.tree',
13+
id: 'ng1.tree.create',
14+
params: [{name: 'depth', value: 9, scale: 'log2'}],
15+
waitForAngular2: false
16+
}).then(done, done.fail);
17+
});
18+
19+
it('should log the stats (update)', function(done) {
20+
runClickBenchmark({
21+
url: URL,
22+
buttons: ['#createDom'],
23+
id: 'ng1.tree.update',
1424
params: [{name: 'depth', value: 9, scale: 'log2'}],
1525
waitForAngular2: false
1626
}).then(done, done.fail);

modules/benchmarks_external/src/tree/polymer/binary_tree.html

Lines changed: 14 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,22 @@
33
<template>
44
<span>
55
<span>{{data.value}}</span>
6-
<!-- TODO(tbosch): use the builtin conditional template when it is available in Polymer 0.8 -->
7-
<span id="leftTree"></span>
8-
<span id="rightTree"></span>
6+
<template is="dom-if" if="[[data.left]]">
7+
<binary-tree data="[[data.left]]"></binary-tree>
8+
</template>
9+
<template is="dom-if" if="[[data.right]]">
10+
<binary-tree data="[[data.right]]"></binary-tree>
11+
</template>
912
</span>
1013
</template>
1114
</dom-module>
1215
<script>
13-
(function() {
14-
Polymer({
15-
is: 'binary-tree',
16-
properties: {
17-
data: Object
18-
},
19-
leftTree: null,
20-
rightTree: null,
21-
dataChanged: function() {
22-
var data = this.data || {};
23-
this._updateTree(data.left, 'leftTree');
24-
this._updateTree(data.right, 'rightTree');
25-
},
26-
_updateTree: function(data, treeName) {
27-
if (data) {
28-
if (!this[treeName]) {
29-
this[treeName] = document.createElement('binary-tree');
30-
}
31-
this[treeName].data = data;
32-
this.$[treeName].appendChild(this[treeName]);
33-
} else {
34-
if (this[treeName]) this[treeName].remove();
35-
this[treeName] = null;
36-
}
37-
},
38-
properties: {
39-
data: 'dataChanged'
40-
}
41-
});
42-
})();
16+
Polymer({
17+
is: 'binary-tree',
18+
properties: {
19+
data: Object
20+
},
21+
leftTree: null,
22+
rightTree: null
23+
});
4324
</script>

modules/benchmarks_external/src/tree/polymer/index.html

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@
55
</head>
66
<body>
77

8-
<h2>TODO</h2>
9-
<ul>
10-
<li>TODO: Does not use shadow DOM</li>
11-
<li>TODO: Does not yet use builtin `if` construct as it uses a preview version of Polymer</li>
12-
</ul
13-
148
<h2>Params</h2>
159
<form>
1610
Depth:
@@ -19,10 +13,9 @@ <h2>Params</h2>
1913
<button>Apply</button>
2014
</form>
2115

22-
<h2>Polymer JS 0.8-preview tree benchmark</h2>
16+
<h2>Polymer JS 1.x tree benchmark</h2>
2317
<root-tree></root-tree>
2418

25-
2619
<script src="url_params_to_form.js" type="text/javascript"></script>
2720

2821
</body>

modules/benchmarks_external/src/tree/tree_benchmark.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ angular.module('app', [])
2727
var transcludeFn;
2828
return {
2929
compile: function(element, attrs) {
30-
var expr = $parse(attrs.treeIf);
30+
var expr = $parse('!!' + attrs.treeIf);
3131
var template = '<tree data="' + attrs.treeIf + '"></tree>';
3232
var transclude;
3333
return function($scope, $element, $attrs) {

modules/upgrade/test/integration_spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ export function main() {
404404
bindToController: true,
405405
template: '{{ctl.status}}',
406406
require: 'ng1',
407+
controllerAs: 'ctrl',
407408
controller: Class({constructor: function() { this.status = 'WORKS'; }}),
408409
link: function(scope, element, attrs, linkController) {
409410
expect(scope.$root).toEqual($rootScope);
@@ -442,6 +443,7 @@ export function main() {
442443
bindToController: true,
443444
template: '{{parent.parent}}:{{ng1.status}}',
444445
require: ['ng1', '^parent', '?^^notFound'],
446+
controllerAs: 'ctrl',
445447
controller: Class({constructor: function() { this.status = 'WORKS'; }}),
446448
link: function(scope, element, attrs, linkControllers) {
447449
expect(linkControllers[0].status).toEqual('WORKS');

npm-shrinkwrap.clean.json

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"version": "5.0.0-alpha.4"
55
},
66
"angular": {
7-
"version": "1.3.5"
7+
"version": "1.4.7"
88
},
99
"angular-animate": {
10-
"version": "1.3.5"
10+
"version": "1.4.7"
1111
},
1212
"angular-mocks": {
13-
"version": "1.3.5"
13+
"version": "1.4.7"
1414
},
1515
"base64-js": {
1616
"version": "0.0.8"
@@ -10723,13 +10723,13 @@
1072310723
"version": "1.3.0"
1072410724
},
1072510725
"react": {
10726-
"version": "0.13.2",
10726+
"version": "0.14.0",
1072710727
"dependencies": {
1072810728
"envify": {
1072910729
"version": "3.4.0",
1073010730
"dependencies": {
1073110731
"through": {
10732-
"version": "2.3.7"
10732+
"version": "2.3.8"
1073310733
},
1073410734
"jstransform": {
1073510735
"version": "10.1.0",
@@ -10744,13 +10744,43 @@
1074410744
"version": "0.1.31",
1074510745
"dependencies": {
1074610746
"amdefine": {
10747-
"version": "0.1.0"
10747+
"version": "1.0.0"
1074810748
}
1074910749
}
1075010750
}
1075110751
}
1075210752
}
1075310753
}
10754+
},
10755+
"fbjs": {
10756+
"version": "0.3.2",
10757+
"dependencies": {
10758+
"core-js": {
10759+
"version": "1.2.3"
10760+
},
10761+
"loose-envify": {
10762+
"version": "1.1.0",
10763+
"dependencies": {
10764+
"js-tokens": {
10765+
"version": "1.0.2"
10766+
}
10767+
}
10768+
},
10769+
"promise": {
10770+
"version": "7.0.4",
10771+
"dependencies": {
10772+
"asap": {
10773+
"version": "2.0.3"
10774+
}
10775+
}
10776+
},
10777+
"ua-parser-js": {
10778+
"version": "0.7.9"
10779+
},
10780+
"whatwg-fetch": {
10781+
"version": "0.9.0"
10782+
}
10783+
}
1075410784
}
1075510785
}
1075610786
},

0 commit comments

Comments
 (0)