diff --git a/benchmark/web/bp.js b/benchmark/web/bp.js index 518ef2999..dc48360c7 100644 --- a/benchmark/web/bp.js +++ b/benchmark/web/bp.js @@ -133,12 +133,13 @@ bp.Runner.runTimedTest = function (bs) { if (typeof window.gc === 'function') { window.gc(); } + var memory = performance.memory ? performance.memory : {usedJSHeapSize: NaN}; - beforeHeap = performance.memory.usedJSHeapSize; + beforeHeap = memory.usedJSHeapSize; startTime = bp.Measure.numMilliseconds(); bs.fn(); endTime = bp.Measure.numMilliseconds() - startTime; - afterHeap = performance.memory.usedJSHeapSize; + afterHeap = memory.usedJSHeapSize; startGCTime = bp.Measure.numMilliseconds(); if (typeof window.gc === 'function') { @@ -146,7 +147,7 @@ bp.Runner.runTimedTest = function (bs) { } endGCTime = bp.Measure.numMilliseconds() - startGCTime; - finalHeap = performance.memory.usedJSHeapSize; + finalHeap = memory.usedJSHeapSize; garbage = Math.abs(finalHeap - afterHeap); retainedMemory = finalHeap - beforeHeap; return { diff --git a/benchmark/web/transcluding-tree-tmpl.html b/benchmark/web/transcluding-tree-tmpl.html new file mode 100644 index 000000000..cd5423a9c --- /dev/null +++ b/benchmark/web/transcluding-tree-tmpl.html @@ -0,0 +1,4 @@ + {{ctrl.data.value}} + + + diff --git a/benchmark/web/tree.dart b/benchmark/web/tree.dart index 2710b73f7..332f94141 100644 --- a/benchmark/web/tree.dart +++ b/benchmark/web/tree.dart @@ -14,21 +14,41 @@ import 'dart:js' as js; '' '' '', - publishAs: 'ctrl') + publishAs: 'ctrl', + useShadowDom: true) class TreeComponent { @NgOneWay('data') var data; } +@Component( + selector: 'transcluding-tree', + template: ' {{ctrl.data.value}}' + '' + '' + '', + publishAs: 'ctrl', + useShadowDom: false) +class TranscludingTreeComponent extends TreeComponent {} + + @Component( selector: 'tree-url', templateUrl: 'tree-tmpl.html', - publishAs: 'ctrl') + publishAs: 'ctrl', + useShadowDom: true) class TreeUrlComponent { @NgOneWay('data') var data; } +@Component( + selector: 'transcluding-tree-url', + templateUrl: 'transcluding-tree-tmpl.html', + publishAs: 'ctrl', + useShadowDom: false) +class TranscludingTreeUrlComponent extends TreeUrlComponent {} + // This is a baseline implementation of TreeComponent. // It assumes the data never changes and simply throws elements on the DOM @@ -250,7 +270,9 @@ main() { var module = new Module() ..bind(TreeComponent) + ..bind(TranscludingTreeComponent) ..bind(TreeUrlComponent) + ..bind(TranscludingTreeUrlComponent) ..bind(NgFreeTree) ..bind(NgFreeTreeScoped) ..bind(NgFreeTreeClass) diff --git a/benchmark/web/tree.html b/benchmark/web/tree.html index e245db00e..46bfe7bf7 100644 --- a/benchmark/web/tree.html +++ b/benchmark/web/tree.html @@ -1,6 +1,11 @@ TreeComponent Benchmark + + + + + @@ -129,14 +134,18 @@

Default:
+
Transcluding:
From URL:
+
Transcluding from URL:
Baseline:
Baseline + scope:
Baseline + class:
+ +