fix(benchmarks): update react and polymer benchmarks and get tree update numbers for all of the benchmarks as well.
Closes #4709
This commit is contained in:
@ -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>
|
||||
|
@ -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:
|
||||
@ -19,10 +13,9 @@
|
||||
<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>
|
||||
|
@ -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) {
|
||||
|
Reference in New Issue
Block a user