Skip to content

Commit

Permalink
fix(benchmarks): update react and polymer benchmarks and get tree upd…
Browse files Browse the repository at this point in the history
…ate numbers for all of the benchmarks as well.

Closes #4709
  • Loading branch information
tbosch committed Oct 28, 2015
1 parent 5c48236 commit bc10dc3
Show file tree
Hide file tree
Showing 13 changed files with 169 additions and 85 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular2",
"dependencies": {
"polymer": "dart-lang/polymer_js#0.8.0-preview"
"polymer": "Polymer/polymer"
}
}
4 changes: 2 additions & 2 deletions modules/benchmarks/e2e_test/static_tree_perf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('ng2 static tree benchmark', function() {
runClickBenchmark({
url: URL,
buttons: ['#baselineDestroyDom', '#baselineCreateDom'],
id: 'baseline.tree.create',
id: 'baseline.static.tree.create',
params: [{name: 'depth', value: 9, scale: 'log2'}]
}).then(done, done.fail);
});
Expand All @@ -46,7 +46,7 @@ describe('ng2 static tree benchmark', function() {
runClickBenchmark({
url: URL,
buttons: ['#baselineCreateDom'],
id: 'baseline.tree.update',
id: 'baseline.static.tree.update',
params: [{name: 'depth', value: 9, scale: 'log2'}]
}).then(done, done.fail);
});
Expand Down
14 changes: 12 additions & 2 deletions modules/benchmarks_external/e2e_test/polymer_tree_perf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,21 @@ describe('polymer tree benchmark', function() {

afterEach(verifyNoBrowserErrors);

it('should log the stats', function(done) {
it('should log the stats (create)', function(done) {
runClickBenchmark({
url: URL,
buttons: ['#destroyDom', '#createDom'],
id: 'polymer.tree',
id: 'polymer.tree.create',
params: [{name: 'depth', value: 9, scale: 'log2'}],
waitForAngular2: false
}).then(done, done.fail);
});

it('should log the stats (update)', function(done) {
runClickBenchmark({
url: URL,
buttons: ['#createDom'],
id: 'polymer.tree.update',
params: [{name: 'depth', value: 9, scale: 'log2'}],
waitForAngular2: false
}).then(done, done.fail);
Expand Down
14 changes: 12 additions & 2 deletions modules/benchmarks_external/e2e_test/static_tree_perf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,21 @@ describe('ng1.x tree benchmark', function() {

afterEach(verifyNoBrowserErrors);

it('should log the stats', function(done) {
it('should log the stats (create)', function(done) {
runClickBenchmark({
url: URL,
buttons: ['#destroyDom', '#createDom'],
id: 'ng1.static.tree',
id: 'ng1.static.tree.create',
params: [],
waitForAngular2: false
}).then(done, done.fail);
});

it('should log the stats (update)', function(done) {
runClickBenchmark({
url: URL,
buttons: ['#createDom'],
id: 'ng1.static.tree.update',
params: [],
waitForAngular2: false
}).then(done, done.fail);
Expand Down
14 changes: 12 additions & 2 deletions modules/benchmarks_external/e2e_test/tree_perf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,21 @@ describe('ng1.x tree benchmark', function() {

afterEach(verifyNoBrowserErrors);

it('should log the stats', function(done) {
it('should log the stats (create)', function(done) {
runClickBenchmark({
url: URL,
buttons: ['#destroyDom', '#createDom'],
id: 'ng1.tree',
id: 'ng1.tree.create',
params: [{name: 'depth', value: 9, scale: 'log2'}],
waitForAngular2: false
}).then(done, done.fail);
});

it('should log the stats (update)', function(done) {
runClickBenchmark({
url: URL,
buttons: ['#createDom'],
id: 'ng1.tree.update',
params: [{name: 'depth', value: 9, scale: 'log2'}],
waitForAngular2: false
}).then(done, done.fail);
Expand Down
47 changes: 14 additions & 33 deletions modules/benchmarks_external/src/tree/polymer/binary_tree.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,22 @@
<template>
<span>
<span>{{data.value}}</span>
<!-- TODO(tbosch): use the builtin conditional template when it is available in Polymer 0.8 -->
<span id="leftTree"></span>
<span id="rightTree"></span>
<template is="dom-if" if="[[data.left]]">
<binary-tree data="[[data.left]]"></binary-tree>
</template>
<template is="dom-if" if="[[data.right]]">
<binary-tree data="[[data.right]]"></binary-tree>
</template>
</span>
</template>
</dom-module>
<script>
(function() {
Polymer({
is: 'binary-tree',
properties: {
data: Object
},
leftTree: null,
rightTree: null,
dataChanged: function() {
var data = this.data || {};
this._updateTree(data.left, 'leftTree');
this._updateTree(data.right, 'rightTree');
},
_updateTree: function(data, treeName) {
if (data) {
if (!this[treeName]) {
this[treeName] = document.createElement('binary-tree');
}
this[treeName].data = data;
this.$[treeName].appendChild(this[treeName]);
} else {
if (this[treeName]) this[treeName].remove();
this[treeName] = null;
}
},
properties: {
data: 'dataChanged'
}
});
})();
Polymer({
is: 'binary-tree',
properties: {
data: Object
},
leftTree: null,
rightTree: null
});
</script>
9 changes: 1 addition & 8 deletions modules/benchmarks_external/src/tree/polymer/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@
</head>
<body>

<h2>TODO</h2>
<ul>
<li>TODO: Does not use shadow DOM</li>
<li>TODO: Does not yet use builtin `if` construct as it uses a preview version of Polymer</li>
</ul

<h2>Params</h2>
<form>
Depth:
Expand All @@ -19,10 +13,9 @@ <h2>Params</h2>
<button>Apply</button>
</form>

<h2>Polymer JS 0.8-preview tree benchmark</h2>
<h2>Polymer JS 1.x tree benchmark</h2>
<root-tree></root-tree>


<script src="url_params_to_form.js" type="text/javascript"></script>

</body>
Expand Down
2 changes: 1 addition & 1 deletion modules/benchmarks_external/src/tree/tree_benchmark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ angular.module('app', [])
var transcludeFn;
return {
compile: function(element, attrs) {
var expr = $parse(attrs.treeIf);
var expr = $parse('!!' + attrs.treeIf);
var template = '<tree data="' + attrs.treeIf + '"></tree>';
var transclude;
return function($scope, $element, $attrs) {
Expand Down
2 changes: 2 additions & 0 deletions modules/upgrade/test/integration_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ export function main() {
bindToController: true,
template: '{{ctl.status}}',
require: 'ng1',
controllerAs: 'ctrl',
controller: Class({constructor: function() { this.status = 'WORKS'; }}),
link: function(scope, element, attrs, linkController) {
expect(scope.$root).toEqual($rootScope);
Expand Down Expand Up @@ -442,6 +443,7 @@ export function main() {
bindToController: true,
template: '{{parent.parent}}:{{ng1.status}}',
require: ['ng1', '^parent', '?^^notFound'],
controllerAs: 'ctrl',
controller: Class({constructor: function() { this.status = 'WORKS'; }}),
link: function(scope, element, attrs, linkControllers) {
expect(linkControllers[0].status).toEqual('WORKS');
Expand Down
42 changes: 36 additions & 6 deletions npm-shrinkwrap.clean.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"version": "5.0.0-alpha.4"
},
"angular": {
"version": "1.3.5"
"version": "1.4.7"
},
"angular-animate": {
"version": "1.3.5"
"version": "1.4.7"
},
"angular-mocks": {
"version": "1.3.5"
"version": "1.4.7"
},
"base64-js": {
"version": "0.0.8"
Expand Down Expand Up @@ -10723,13 +10723,13 @@
"version": "1.3.0"
},
"react": {
"version": "0.13.2",
"version": "0.14.0",
"dependencies": {
"envify": {
"version": "3.4.0",
"dependencies": {
"through": {
"version": "2.3.7"
"version": "2.3.8"
},
"jstransform": {
"version": "10.1.0",
Expand All @@ -10744,13 +10744,43 @@
"version": "0.1.31",
"dependencies": {
"amdefine": {
"version": "0.1.0"
"version": "1.0.0"
}
}
}
}
}
}
},
"fbjs": {
"version": "0.3.2",
"dependencies": {
"core-js": {
"version": "1.2.3"
},
"loose-envify": {
"version": "1.1.0",
"dependencies": {
"js-tokens": {
"version": "1.0.2"
}
}
},
"promise": {
"version": "7.0.4",
"dependencies": {
"asap": {
"version": "2.0.3"
}
}
},
"ua-parser-js": {
"version": "0.7.9"
},
"whatwg-fetch": {
"version": "0.9.0"
}
}
}
}
},
Expand Down
Loading

0 comments on commit bc10dc3

Please sign in to comment.