This repository was archived by the owner on Feb 22, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +41
-5
lines changed Expand file tree Collapse file tree 4 files changed +41
-5
lines changed Original file line number Diff line number Diff line change @@ -133,20 +133,21 @@ bp.Runner.runTimedTest = function (bs) {
133
133
if ( typeof window . gc === 'function' ) {
134
134
window . gc ( ) ;
135
135
}
136
+ var memory = performance . memory ? performance . memory : { usedJSHeapSize : NaN } ;
136
137
137
- beforeHeap = performance . memory . usedJSHeapSize ;
138
+ beforeHeap = memory . usedJSHeapSize ;
138
139
startTime = bp . Measure . numMilliseconds ( ) ;
139
140
bs . fn ( ) ;
140
141
endTime = bp . Measure . numMilliseconds ( ) - startTime ;
141
- afterHeap = performance . memory . usedJSHeapSize ;
142
+ afterHeap = memory . usedJSHeapSize ;
142
143
143
144
startGCTime = bp . Measure . numMilliseconds ( ) ;
144
145
if ( typeof window . gc === 'function' ) {
145
146
window . gc ( ) ;
146
147
}
147
148
endGCTime = bp . Measure . numMilliseconds ( ) - startGCTime ;
148
149
149
- finalHeap = performance . memory . usedJSHeapSize ;
150
+ finalHeap = memory . usedJSHeapSize ;
150
151
garbage = Math . abs ( finalHeap - afterHeap ) ;
151
152
retainedMemory = finalHeap - beforeHeap ;
152
153
return {
Original file line number Diff line number Diff line change
1
+ < span > {{ctrl.data.value}}
2
+ < span ng-if ="ctrl.data.right != null "> < transcluding-tree-url data =ctrl.data.right > </ span >
3
+ < span ng-if ="ctrl.data.left != null "> < transcluding-tree-url data =ctrl.data.left > </ span >
4
+ </ span >
Original file line number Diff line number Diff line change @@ -14,21 +14,41 @@ import 'dart:js' as js;
14
14
'<span ng-if="ctrl.data.right != null"><tree data=ctrl.data.right></span>'
15
15
'<span ng-if="ctrl.data.left != null"><tree data=ctrl.data.left></span>'
16
16
'</span>' ,
17
- publishAs: 'ctrl' )
17
+ publishAs: 'ctrl' ,
18
+ useShadowDom: true )
18
19
class TreeComponent {
19
20
@NgOneWay ('data' )
20
21
var data;
21
22
}
22
23
24
+ @Component (
25
+ selector: 'transcluding-tree' ,
26
+ template: '<span> {{ctrl.data.value}}'
27
+ '<span ng-if="ctrl.data.right != null"><transcluding-tree data=ctrl.data.right></span>'
28
+ '<span ng-if="ctrl.data.left != null"><transcluding-tree data=ctrl.data.left></span>'
29
+ '</span>' ,
30
+ publishAs: 'ctrl' ,
31
+ useShadowDom: false )
32
+ class TranscludingTreeComponent extends TreeComponent {}
33
+
34
+
23
35
@Component (
24
36
selector: 'tree-url' ,
25
37
templateUrl: 'tree-tmpl.html' ,
26
- publishAs: 'ctrl' )
38
+ publishAs: 'ctrl' ,
39
+ useShadowDom: true )
27
40
class TreeUrlComponent {
28
41
@NgOneWay ('data' )
29
42
var data;
30
43
}
31
44
45
+ @Component (
46
+ selector: 'transcluding-tree-url' ,
47
+ templateUrl: 'transcluding-tree-tmpl.html' ,
48
+ publishAs: 'ctrl' ,
49
+ useShadowDom: false )
50
+ class TranscludingTreeUrlComponent extends TreeUrlComponent {}
51
+
32
52
33
53
// This is a baseline implementation of TreeComponent.
34
54
// It assumes the data never changes and simply throws elements on the DOM
@@ -250,7 +270,9 @@ main() {
250
270
251
271
var module = new Module ()
252
272
..bind (TreeComponent )
273
+ ..bind (TranscludingTreeComponent )
253
274
..bind (TreeUrlComponent )
275
+ ..bind (TranscludingTreeUrlComponent )
254
276
..bind (NgFreeTree )
255
277
..bind (NgFreeTreeScoped )
256
278
..bind (NgFreeTreeClass )
Original file line number Diff line number Diff line change 1
1
< html >
2
2
< head >
3
3
< title > TreeComponent Benchmark</ title >
4
+
5
+ <!-- Uncomment to test in Firefox -->
6
+ <!--<script src="packages/web_components/platform.js"></script>-->
7
+ <!--<script src="packages/web_components/dart_support.js"></script>-->
8
+
4
9
< script src ="underscore.js "> </ script >
5
10
< script src ="bp.js "> </ script >
6
11
< script src ="tree.dart " type ="application/dart "> </ script >
129
134
</ p >
130
135
131
136
< div > Default: < input type =checkbox ng-model ="useDefault "> </ div >
137
+ < div > Transcluding: < input type =checkbox ng-model ="useTranscluding "> </ div >
132
138
< div > From URL: < input type =checkbox ng-model ="useUrl "> </ div >
139
+ < div > Transcluding from URL: < input type =checkbox ng-model ="useTranscludingFromUrl "> </ div >
133
140
< div > Baseline: < input type =checkbox ng-model ="useBaseline "> </ div >
134
141
< div > Baseline + scope: < input type =checkbox ng-model ="useBaselineScoped "> </ div >
135
142
< div > Baseline + class: < input type =checkbox ng-model ="useBaselineClass "> </ div >
136
143
137
144
138
145
< tree ng-if ="useDefault " data =initData > </ tree >
146
+ < transcluding-tree ng-if ="useTranscluding " data =initData > </ transcluding-tree >
139
147
< tree-url ng-if ="useUrl " data =initData > </ tree-url >
148
+ < transcluding-tree-url ng-if ="useTranscludingFromUrl " data =initData > </ transcluding-tree-url >
140
149
141
150
< ng-free-tree ng-if ="useBaseline " data =initData > </ ng-free-tree >
142
151
< ng-free-tree-scoped ng-if ="useBaselineScoped " data =initData > </ ng-free-tree-scoped >
You can’t perform that action at this time.
0 commit comments