diff --git a/modules/benchmarks/src/largetable/incremental_dom/BUILD.bazel b/modules/benchmarks/src/largetable/incremental_dom/BUILD.bazel deleted file mode 100644 index 42a5063a3367..000000000000 --- a/modules/benchmarks/src/largetable/incremental_dom/BUILD.bazel +++ /dev/null @@ -1,50 +0,0 @@ -load("//tools:defaults.bzl", "app_bundle", "http_server", "ts_library") -load("@npm//@angular/build-tooling/bazel/benchmark/component_benchmark:benchmark_test.bzl", "benchmark_test") -load("//modules/benchmarks:e2e_test.bzl", "e2e_test") - -package(default_visibility = ["//modules/benchmarks:__subpackages__"]) - -ts_library( - name = "incremental_dom", - srcs = glob(["*.ts"]), - tsconfig = "//modules/benchmarks:tsconfig-build.json", - deps = [ - "//modules/benchmarks/src:util_lib", - "//modules/benchmarks/src/largetable:util_lib", - ], -) - -app_bundle( - name = "bundle", - entry_point = ":index.ts", - deps = [":incremental_dom"], -) - -# The script needs to be called `app_bundle` for easier syncing into g3. -genrule( - name = "app_bundle", - srcs = [":bundle.debug.min.js"], - outs = ["app_bundle.js"], - cmd = "cp $< $@", -) - -http_server( - name = "devserver", - srcs = [ - "index.html", - "@npm//:node_modules/incremental-dom/dist/incremental-dom.js", - ], - deps = [":app_bundle"], -) - -benchmark_test( - name = "perf", - server = ":devserver", - deps = ["//modules/benchmarks/src/largetable:perf_tests_lib"], -) - -e2e_test( - name = "e2e", - server = ":devserver", - deps = ["//modules/benchmarks/src/largetable:e2e_tests_lib"], -) diff --git a/modules/benchmarks/src/largetable/incremental_dom/index.html b/modules/benchmarks/src/largetable/incremental_dom/index.html deleted file mode 100644 index 6e51de046929..000000000000 --- a/modules/benchmarks/src/largetable/incremental_dom/index.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - -

Params

-
- Cols: - -
- Rows: - -
- -
- -

Incremental-Dom Largetable Benchmark

-

- - - - -

- -
- -
- - - - - - - - - diff --git a/modules/benchmarks/src/largetable/incremental_dom/index.ts b/modules/benchmarks/src/largetable/incremental_dom/index.ts deleted file mode 100644 index 81bb30745263..000000000000 --- a/modules/benchmarks/src/largetable/incremental_dom/index.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {bindAction, profile} from '../../util'; -import {buildTable, emptyTable, initTableUtils} from '../util'; - -import {TableComponent} from './table'; - -let table: TableComponent; - -function destroyDom() { - table.data = emptyTable; -} - -function createDom() { - table.data = buildTable(); -} - -function noop() {} - -function init() { - table = new TableComponent(document.querySelector('largetable')); - - initTableUtils(); - - bindAction('#destroyDom', destroyDom); - bindAction('#createDom', createDom); - - bindAction('#updateDomProfile', profile(createDom, noop, 'update')); - bindAction('#createDomProfile', profile(createDom, destroyDom, 'create')); -} - -init(); diff --git a/modules/benchmarks/src/largetable/incremental_dom/table.ts b/modules/benchmarks/src/largetable/incremental_dom/table.ts deleted file mode 100644 index d224271f7da1..000000000000 --- a/modules/benchmarks/src/largetable/incremental_dom/table.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {TableCell} from '../util'; - -// We load "IncrementalDOM" as a AMD global because the "incremental-dom" NPM package does not -// come with a named UMD module, and it's easier to just import the AMD file and use it globally. -declare const IncrementalDOM: any; -const {patch, elementOpen, elementClose, elementOpenStart, elementOpenEnd, attr, text} = - IncrementalDOM; - -export class TableComponent { - constructor(private _rootEl: any) {} - - set data(data: TableCell[][]) { - patch(this._rootEl, () => this._render(data)); - } - - private _render(data: TableCell[][]) { - elementOpen('table'); - elementOpen('tbody'); - for (let r = 0; r < data.length; r++) { - elementOpen('tr'); - const row = data[r]; - for (let c = 0; c < row.length; c++) { - elementOpenStart('td'); - if (r % 2 === 0) { - attr('style', 'background-color: grey'); - } - elementOpenEnd('td'); - text(row[c].value); - elementClose('td'); - } - elementClose('tr'); - } - elementClose('tbody'); - elementClose('table'); - } -} diff --git a/modules/benchmarks/src/largetable/iv/BUILD.bazel b/modules/benchmarks/src/largetable/iv/BUILD.bazel deleted file mode 100644 index 14fc0a20e59f..000000000000 --- a/modules/benchmarks/src/largetable/iv/BUILD.bazel +++ /dev/null @@ -1,25 +0,0 @@ -load("//tools:defaults.bzl", "http_server") -load("@npm//@angular/build-tooling/bazel/benchmark/component_benchmark:benchmark_test.bzl", "benchmark_test") -load("//modules/benchmarks:e2e_test.bzl", "e2e_test") - -package(default_visibility = ["//modules/benchmarks:__subpackages__"]) - -http_server( - name = "devserver", - srcs = [ - "app_bundle.js", - "index.html", - ], -) - -benchmark_test( - name = "perf", - server = ":devserver", - deps = ["//modules/benchmarks/src/largetable:perf_tests_lib"], -) - -e2e_test( - name = "e2e", - server = ":devserver", - deps = ["//modules/benchmarks/src/largetable:e2e_tests_lib"], -) diff --git a/modules/benchmarks/src/largetable/iv/app_bundle.js b/modules/benchmarks/src/largetable/iv/app_bundle.js deleted file mode 100644 index 274b330875be..000000000000 --- a/modules/benchmarks/src/largetable/iv/app_bundle.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -/* tslint:disable */ -// clang-format off -function $nextRef(){return++refCount}function $el(e,n,r,t){var o={kind:"E",index:n,name:r,ref:t?++refCount:0,children:[],props:NO_PROPS,domNode:null};return e.children[e.children.length]=o,o}function $cg(e,n,r,t){var o=n.children[e];if(o&&o.index===t)return o.childChanges=null,o;var a={kind:"G",index:t,cm:1,props:{},changes:null,childChanges:null,ref:++refCount,children:[],domNode:null,parent:n,$lastChange:refreshCount,$lastRefresh:refreshCount};return r.cm?n.children[n.children.length]=a:(n.children.splice(e,0,a),addChangeInstruction(a,{kind:"CG",node:a,parent:n,position:e,nextSibling:findNextDomSibling(n,e)})),a}function $lg(e,n){addChildChanges(e,n)}function $dg(e,n,r,t){for(var o=n.children[e];o&&o.indexi;i++)retrieveChanges(t[i],n,r);r&&(e.childChanges=null)}if(o&&o.length){for(var a=n.length,i=0;o.length>i;i++,a++)n[a]=o[i];r&&(e.changes=null)}}function addChangeInstruction(e,n){e.changes?e.changes.splice(e.changes.length,0,n):e.changes=[n],e.$lastChange=refreshCount}function addChildChanges(e,n){(e.changes||e.childChanges)&&(n.childChanges?n.childChanges.push(e):n.childChanges=[e],n.$lastChange=refreshCount)}function findNextDomSibling(e,n,r){void 0===r&&(r=!1);var t,o=e.children;if(n+1i;i++)if(a.children[i]===e)return findNextDomSibling(a,i)}return null}function htmlRenderer(e,n,r){return new Renderer(e,n,r)}function processChanges(e,n,r){for(var t=0,o=e;ti;i++)createDomNode(o[i],n,r,t)}function createElementDomNode(e,n,r,t){var o,a,i=e.props,d=e.atts;if(d&&d.xmlns&&(t=d.xmlns),a=t?r.createElementNS(t,e.name):r.createElement(e.name),d)for(var l in d)d.hasOwnProperty(l)&&a.setAttribute(l,d[l]);if(i)if(t&&!t.match(RX_HTML))for(var l in i)i.hasOwnProperty(l)&&a.setAttribute(l,i[l]);else for(var l in i)if(i.hasOwnProperty(l)&&void 0!==(o=i[l]))if(o&&o.$isMap)if("classList"===l){var c=[];d&&(d.class?c.push(d.class):d.className&&c.push(d.className));for(var s in o)o.hasOwnProperty(s)&&"$"!==s[0]&&o[s]&&c.push(s);c.length&&(a.className=c.join(" "))}else"style"===l&&setMapProperties(a.style,o);else o.call?"o"===l[0]&&addEvtListener(a,e,l):a[l]=o;e.domNode=a,n.appendChild(a),processChildNodes(e,a,r,t)}function setMapProperties(e,n){for(var r in n)n.hasOwnProperty(r)&&"$"!==r[0]&&(e[r]=n[r])}function addEvtListener(e,n,r){e.addEventListener(r.substring(2),function(e){n.props[r].call(n,e)})}function removeGroupFromDom(e,n,r){var t,o=e.children,a=e.domNode;if(o){var i=o.length;n&&r&&countGroupDomChildren(e)===a.childNodes.length&&(a.textContent="",n=!1);for(var d=0;i>d;d++)"G"===(t=o[d]).kind?removeGroupFromDom(t,n,!1):"T"!==t.kind&&"E"!==t.kind||n&&t.domNode&&t.domNode.parentNode===a&&a.removeChild(t.domNode)}e.domNode=null}function countGroupDomChildren(e){for(var n,r,t=0,o=e.children,a=o.length,i=0;a>i;i++)"G"===(r=(n=o[i]).kind)?t+=countGroupDomChildren(n):"D"!==r&&t++;return t}function replaceDomNode(e,n,r){if(e!==n&&r.domNode===e&&(r.domNode=n,"G"===r.kind))for(var t=r.children,o=0;t.length>o;o++)replaceDomNode(e,n,t[o])}function getIntParameter(e){return parseInt(getStringParameter(e),10)}function getStringParameter(e){for(var n,r,t=document.querySelectorAll('input[name="'+e+'"]'),o=0;o - - - - - - -

Params

-
- Cols: - -
- Rows: - -
- -
- -

IV Largetable Benchmark

-

- - - - -

- -
- -
- - - - - diff --git a/modules/benchmarks/src/old/compiler/compiler_benchmark.html b/modules/benchmarks/src/old/compiler/compiler_benchmark.html deleted file mode 100644 index 26d00701ebc5..000000000000 --- a/modules/benchmarks/src/old/compiler/compiler_benchmark.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - -

Params

-
- Elements: - -
- -
- -

Actions

-

- - -

- - -$SCRIPTS$ - - - diff --git a/modules/benchmarks/src/old/compiler/compiler_benchmark.ts b/modules/benchmarks/src/old/compiler/compiler_benchmark.ts deleted file mode 100644 index 4f57f7aa4b4a..000000000000 --- a/modules/benchmarks/src/old/compiler/compiler_benchmark.ts +++ /dev/null @@ -1,183 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {CompilerConfig, DirectiveResolver} from '@angular/compiler'; -import {Component, ComponentResolver, Directive, ViewContainerRef,} from '@angular/core'; -import {ViewMetadata} from '@angular/core/view'; -import {PromiseWrapper} from '@angular/facade/src/async'; -import {print, Type} from '@angular/facade/src/lang'; -import {bootstrap} from '@angular/platform-browser'; -import {BrowserDomAdapter} from '@angular/platform-browser/src/browser/browser_adapter'; -import {DOM} from '@angular/platform-browser/src/dom/dom_adapter'; -import {bindAction, getIntParameter} from '@angular/testing/src/benchmark_util'; - -function _createBindings(): any[] { - const multiplyTemplatesBy = getIntParameter('elements'); - return [ - { - provide: DirectiveResolver, - useFactory: () => new MultiplyDirectiveResolver( - multiplyTemplatesBy, [BenchmarkComponentNoBindings, BenchmarkComponentWithBindings]), - deps: [] - }, - // Use interpretative mode as Dart does not support JIT and - // we want to be able to compare the numbers between JS and Dart - { - provide: CompilerConfig, - useValue: new CompilerConfig({genDebugInfo: false, useJit: false, logBindingUpdate: false}) - } - ]; -} - -export function main() { - BrowserDomAdapter.makeCurrent(); - bootstrap(CompilerAppComponent, _createBindings()).then((ref) => { - const app = ref.instance; - bindAction('#compileNoBindings', measureWrapper(() => app.compileNoBindings(), 'No Bindings')); - bindAction( - '#compileWithBindings', measureWrapper(() => app.compileWithBindings(), 'With Bindings')); - }); -} - -function measureWrapper(func, desc) { - return function() { - const begin = new Date(); - print(`[${desc}] Begin...`); - const onSuccess = function(_) { - const elapsedMs = new Date().getTime() - begin.getTime(); - print(`[${desc}] ...done, took ${elapsedMs} ms`); - }; - const onError = function(e) { - DOM.logError(e); - }; - PromiseWrapper.then(func(), onSuccess, onError); - }; -} - - -class MultiplyDirectiveResolver extends DirectiveResolver { - private _multiplyBy: number; - private _cache = new Map(); - - constructor(multiple: number, components: Type[]) { - super(); - this._multiplyBy = multiple; - components.forEach(c => this._fillCache(c)); - } - - private _fillCache(component: Type) { - const view = super.resolve(component); - const multipliedTemplates = []; - for (let i = 0; i < this._multiplyBy; ++i) { - multipliedTemplates[i] = view.template; - } - this._cache.set( - component, - new ViewMetadata({template: multipliedTemplates.join(''), directives: view.directives})); - } - - resolve(component: Type): ViewMetadata { - return this._cache.get(component) || super.resolve(component); - } -} - -@Component({selector: 'app', directives: [], template: ``}) -class CompilerAppComponent { - constructor(private _compiler: ComponentResolver) {} - compileNoBindings() { - this._compiler.clearCache(); - return this._compiler.resolveComponent(BenchmarkComponentNoBindings); - } - - compileWithBindings() { - this._compiler.clearCache(); - return this._compiler.resolveComponent(BenchmarkComponentWithBindings); - } -} - -@Directive({selector: '[dir0]', inputs: ['prop: attr0']}) -class Dir0 { - prop: any; -} - -@Directive({selector: '[dir1]', inputs: ['prop: attr1']}) -class Dir1 { - prop: any; - constructor(dir0: Dir0) {} -} - -@Directive({selector: '[dir2]', inputs: ['prop: attr2']}) -class Dir2 { - prop: any; - constructor(dir1: Dir1) {} -} - -@Directive({selector: '[dir3]', inputs: ['prop: attr3']}) -class Dir3 { - prop: any; - constructor(dir2: Dir2) {} -} - -@Directive({selector: '[dir4]', inputs: ['prop: attr4']}) -class Dir4 { - prop: any; - constructor(dir3: Dir3) {} -} - - -@Component({ - selector: 'cmp-nobind', - directives: [Dir0, Dir1, Dir2, Dir3, Dir4], - template: ` -
-
-
-
-
-
-
-
-
-
` -}) -class BenchmarkComponentNoBindings { -} - -@Component({ - selector: 'cmp-withbind', - directives: [Dir0, Dir1, Dir2, Dir3, Dir4], - template: ` -
- {{inter0}}{{inter1}}{{inter2}}{{inter3}}{{inter4}} -
- {{inter0}}{{inter1}}{{inter2}}{{inter3}}{{inter4}} -
- {{inter0}}{{inter1}}{{inter2}}{{inter3}}{{inter4}} -
- {{inter0}}{{inter1}}{{inter2}}{{inter3}}{{inter4}} -
- {{inter0}}{{inter1}}{{inter2}}{{inter3}}{{inter4}} -
-
-
-
-
` -}) -class BenchmarkComponentWithBindings { - value0: any; - value1: any; - value2: any; - value3: any; - value4: any; - - inter0: any; - inter1: any; - inter2: any; - inter3: any; - inter4: any; -} diff --git a/modules/benchmarks/src/old/compiler/selector_benchmark.html b/modules/benchmarks/src/old/compiler/selector_benchmark.html deleted file mode 100644 index a8e3d38a34ad..000000000000 --- a/modules/benchmarks/src/old/compiler/selector_benchmark.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - -

Params

-
- Selectors: - -
- -
- -

Actions

-

- - - -

- -$SCRIPTS$ - - - \ No newline at end of file diff --git a/modules/benchmarks/src/old/compiler/selector_benchmark.ts b/modules/benchmarks/src/old/compiler/selector_benchmark.ts deleted file mode 100644 index 72a301a60353..000000000000 --- a/modules/benchmarks/src/old/compiler/selector_benchmark.ts +++ /dev/null @@ -1,90 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {CssSelector, SelectorMatcher} from '@angular/compiler/src/selector'; -import {BrowserDomAdapter} from '@angular/platform-browser/src/browser/browser_adapter'; -import {bindAction, getIntParameter} from '@angular/testing/src/benchmark_util'; - -export function main() { - BrowserDomAdapter.makeCurrent(); - const count = getIntParameter('selectors'); - - let fixedMatcher; - const fixedSelectorStrings = []; - const fixedSelectors = []; - for (let i = 0; i < count; i++) { - fixedSelectorStrings.push(randomSelector()); - } - for (let i = 0; i < count; i++) { - fixedSelectors.push(CssSelector.parse(fixedSelectorStrings[i])); - } - fixedMatcher = new SelectorMatcher(); - for (let i = 0; i < count; i++) { - fixedMatcher.addSelectables(fixedSelectors[i], i); - } - - function parse() { - const result = []; - for (let i = 0; i < count; i++) { - result.push(CssSelector.parse(fixedSelectorStrings[i])); - } - return result; - } - - function addSelectable() { - const matcher = new SelectorMatcher(); - for (let i = 0; i < count; i++) { - matcher.addSelectables(fixedSelectors[i], i); - } - return matcher; - } - - function match() { - let matchCount = 0; - for (let i = 0; i < count; i++) { - fixedMatcher.match(fixedSelectors[i][0], (selector, selected) => { - matchCount += selected; - }); - } - return matchCount; - } - - bindAction('#parse', parse); - bindAction('#addSelectable', addSelectable); - bindAction('#match', match); -} - -function randomSelector() { - let res = randomStr(5); - for (let i = 0; i < 3; i++) { - res += '.' + randomStr(5); - } - for (let i = 0; i < 3; i++) { - res += '[' + randomStr(3) + '=' + randomStr(6) + ']'; - } - return res; -} - -function randomStr(len) { - let s = ''; - while (s.length < len) { - s += randomChar(); - } - return s; -} - -function randomChar() { - const n = randomNum(62); - if (n < 10) return n.toString(); // 1-10 - if (n < 36) return StringWrapper.fromCharCode(n + 55); // A-Z - return StringWrapper.fromCharCode(n + 61); // a-z -} - -function randomNum(max) { - return Math.floor(Math.random() * max); -} diff --git a/modules/benchmarks/src/old/costs/index.html b/modules/benchmarks/src/old/costs/index.html deleted file mode 100644 index d2d4507a67b8..000000000000 --- a/modules/benchmarks/src/old/costs/index.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - -

Params

-
- Size: - -
- -
- -

Benchmarks

- - - - - - - - - - - - - - -
Baseline (plain components)
Cost of decorators
Cost of dynamic components
- - - -$SCRIPTS$ - - \ No newline at end of file diff --git a/modules/benchmarks/src/old/costs/index.ts b/modules/benchmarks/src/old/costs/index.ts deleted file mode 100644 index 2ae0d8e30237..000000000000 --- a/modules/benchmarks/src/old/costs/index.ts +++ /dev/null @@ -1,123 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {NgFor, NgIf} from '@angular/common'; -import {Component, Directive, DynamicComponentLoader, ViewContainerRef} from '@angular/core'; -import {ApplicationRef} from '@angular/core/src/application_ref'; -import {ListWrapper} from '@angular/facade/src/lang'; -import {bootstrap, BrowserModule} from '@angular/platform-browser'; -import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; -import {bindAction, getIntParameter} from '@angular/testing/src/benchmark_util'; - -let testList = null; - -export function main() { - const size = getIntParameter('size'); - testList = []; - - platformBrowserDynamic().bootstrapModule(AppModule).then((ref) => { - const injector = ref.injector; - const app: AppComponent = ref.instance; - const appRef = injector.get(ApplicationRef); - - bindAction('#reset', function() { - app.reset(); - appRef.tick(); - }); - - // Baseline (plain components) - bindAction('#createPlainComponents', function() { - app.createPlainComponents(); - appRef.tick(); - }); - - // Components with decorators - bindAction('#createComponentsWithDirectives', function() { - app.createComponentsWithDirectives(); - appRef.tick(); - }); - - // Components with decorators - bindAction('#createDynamicComponents', function() { - app.createDynamicComponents(); - appRef.tick(); - }); - }); -} - - -@Component({selector: 'dummy', template: `
`}) -class DummyComponent { -} - -@Directive({selector: '[dummy-decorator]'}) -class DummyDirective { -} - -@Directive({selector: 'dynamic-dummy'}) -class DynamicDummy { - constructor(loader: DynamicComponentLoader, location: ViewContainerRef) { - loader.loadNextToLocation(DummyComponent, location); - } -} - -@Component({ - selector: 'app', - directives: [NgIf, NgFor, DummyComponent, DummyDirective, DynamicDummy], - template: ` -
- -
- -
- -
- -
- -
- ` -}) -class AppComponent { - list: any[]; - testingPlainComponents: boolean; - testingWithDirectives: boolean; - testingDynamicComponents: boolean; - - constructor() { - this.reset(); - } - - reset(): void { - this.list = []; - this.testingPlainComponents = false; - this.testingWithDirectives = false; - this.testingDynamicComponents = false; - } - - createPlainComponents(): void { - this.list = testList; - this.testingPlainComponents = true; - } - - createComponentsWithDirectives(): void { - this.list = testList; - this.testingWithDirectives = true; - } - - createDynamicComponents(): void { - this.list = testList; - this.testingDynamicComponents = true; - } -} - - - -@NgModule({imports: [BrowserModule], bootstrap: [AppComponent]}) -class AppModule { -} diff --git a/modules/benchmarks/src/old/naive_infinite_scroll/app.ts b/modules/benchmarks/src/old/naive_infinite_scroll/app.ts deleted file mode 100644 index 613209a846d8..000000000000 --- a/modules/benchmarks/src/old/naive_infinite_scroll/app.ts +++ /dev/null @@ -1,100 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {NgFor, NgIf} from '@angular/common'; -import {Component, Directive} from '@angular/core'; -import {TimerWrapper} from '@angular/facade/src/async'; -import {document} from '@angular/facade/src/browser'; -import {isPresent} from '@angular/facade/src/lang'; -import {DOM} from '@angular/platform-browser/src/dom/dom_adapter'; -import {bindAction, getIntParameter} from '@angular/testing/src/benchmark_util'; - -import {ScrollAreaComponent} from './scroll_area'; - - -@Component({ - selector: 'scroll-app', - directives: [ScrollAreaComponent, NgIf, NgFor], - template: ` -
-
- -
-
-

Following tables are only here to add weight to the UI:

- -
-
` -}) -export class App { - scrollAreas: number[]; - iterationCount: number; - scrollIncrement: number; - - constructor() { - let appSize = getIntParameter('appSize'); - this.iterationCount = getIntParameter('iterationCount'); - this.scrollIncrement = getIntParameter('scrollIncrement'); - appSize = appSize > 1 ? appSize - 1 : 0; // draw at least one table - this.scrollAreas = []; - for (let i = 0; i < appSize; i++) { - this.scrollAreas.push(i); - } - bindAction('#run-btn', () => { - this.runBenchmark(); - }); - bindAction('#reset-btn', () => { - this._getScrollDiv().scrollTop = 0; - const existingMarker = this._locateFinishedMarker(); - if (existingMarker != null) { - DOM.removeChild(document.body, existingMarker); - } - }); - } - - runBenchmark() { - const scrollDiv = this._getScrollDiv(); - let n: number = this.iterationCount; - let scheduleScroll; - scheduleScroll = () => { - TimerWrapper.setTimeout(() => { - scrollDiv.scrollTop += this.scrollIncrement; - n--; - if (n > 0) { - scheduleScroll(); - } else { - this._scheduleFinishedMarker(); - } - }, 0); - }; - scheduleScroll(); - } - - // Puts a marker indicating that the test is finished. - private _scheduleFinishedMarker() { - const existingMarker = this._locateFinishedMarker(); - if (existingMarker != null) { - // Nothing to do, the marker is already there - return; - } - TimerWrapper.setTimeout(() => { - const finishedDiv = DOM.createElement('div'); - finishedDiv.id = 'done'; - DOM.setInnerHTML(finishedDiv, 'Finished'); - DOM.appendChild(document.body, finishedDiv); - }, 0); - } - - private _locateFinishedMarker() { - return DOM.querySelector(document.body, '#done'); - } - - private _getScrollDiv() { - return DOM.query('body /deep/ #scrollDiv'); - } -} diff --git a/modules/benchmarks/src/old/naive_infinite_scroll/cells.ts b/modules/benchmarks/src/old/naive_infinite_scroll/cells.ts deleted file mode 100644 index fdfc5eb3f407..000000000000 --- a/modules/benchmarks/src/old/naive_infinite_scroll/cells.ts +++ /dev/null @@ -1,142 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {NgFor} from '@angular/common'; -import {Component, Directive} from '@angular/core'; - -import {Account, Company, CustomDate, Offering, Opportunity, STATUS_LIST} from './common'; - -export class HasStyle { - cellWidth: number; - - constructor() {} - - set width(w: number) { - this.cellWidth = w; - } -} - -@Component({ - selector: 'company-name', - inputs: ['width: cell-width', 'company'], - directives: [], - template: `
{{company.name}}
` -}) -export class CompanyNameComponent extends HasStyle { - company: Company; -} - -@Component({ - selector: 'opportunity-name', - inputs: ['width: cell-width', 'opportunity'], - directives: [], - template: `
{{opportunity.name}}
` -}) -export class OpportunityNameComponent extends HasStyle { - opportunity: Opportunity; -} - -@Component({ - selector: 'offering-name', - inputs: ['width: cell-width', 'offering'], - directives: [], - template: `
{{offering.name}}
` -}) -export class OfferingNameComponent extends HasStyle { - offering: Offering; -} - -export class Stage { - name: string; - isDisabled: boolean; - backgroundColor: string; - apply: Function; -} - -@Component({ - selector: 'stage-buttons', - inputs: ['width: cell-width', 'offering'], - directives: [NgFor], - template: ` -
- -
` -}) -export class StageButtonsComponent extends HasStyle { - private _offering: Offering; - stages: Stage[]; - - get offering(): Offering { - return this._offering; - } - - set offering(offering: Offering) { - this._offering = offering; - this._computeStageButtons(); - } - - setStage(stage: Stage) { - this._offering.status = stage.name; - this._computeStageButtons(); - } - - private _computeStageButtons() { - let disabled = true; - this.stages = STATUS_LIST - .map((status) => { - const isCurrent = this._offering.status == status; - const stage = new Stage(); - stage.name = status; - stage.isDisabled = disabled; - stage.backgroundColor = disabled ? '#DDD' : isCurrent ? '#DDF' : '#FDD'; - if (isCurrent) { - disabled = false; - } - return stage; - }) - .slice(); - } -} - -@Component({ - selector: 'account-cell', - inputs: ['width: cell-width', 'account'], - directives: [], - template: ` - ` -}) -export class AccountCellComponent extends HasStyle { - account: Account; -} - -@Component({ - selector: 'formatted-cell', - inputs: ['width: cell-width', 'value'], - directives: [], - template: `
{{formattedValue}}
` -}) -export class FormattedCellComponent extends HasStyle { - formattedValue: string; - - set value(value) { - if (value instanceof CustomDate) { - this.formattedValue = `${value.month}/${value.day}/${value.year}`; - } else { - this.formattedValue = value.toString(); - } - } -} diff --git a/modules/benchmarks/src/old/naive_infinite_scroll/common.ts b/modules/benchmarks/src/old/naive_infinite_scroll/common.ts deleted file mode 100644 index 20d2ca143188..000000000000 --- a/modules/benchmarks/src/old/naive_infinite_scroll/common.ts +++ /dev/null @@ -1,224 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {Math} from '@angular/facade/src/math'; - -export const ITEMS = 1000; -export const ITEM_HEIGHT = 40; -export const VISIBLE_ITEMS = 17; - -export const HEIGHT = ITEMS * ITEM_HEIGHT; -export const VIEW_PORT_HEIGHT = ITEM_HEIGHT * VISIBLE_ITEMS; - -export const COMPANY_NAME_WIDTH = 100; -export const OPPORTUNITY_NAME_WIDTH = 100; -export const OFFERING_NAME_WIDTH = 100; -export const ACCOUNT_CELL_WIDTH = 50; -export const BASE_POINTS_WIDTH = 50; -export const KICKER_POINTS_WIDTH = 50; -export const STAGE_BUTTONS_WIDTH = 220; -export const BUNDLES_WIDTH = 120; -export const DUE_DATE_WIDTH = 100; -export const END_DATE_WIDTH = 100; -export const AAT_STATUS_WIDTH = 100; -export const ROW_WIDTH = COMPANY_NAME_WIDTH + OPPORTUNITY_NAME_WIDTH + OFFERING_NAME_WIDTH + - ACCOUNT_CELL_WIDTH + BASE_POINTS_WIDTH + KICKER_POINTS_WIDTH + STAGE_BUTTONS_WIDTH + - BUNDLES_WIDTH + DUE_DATE_WIDTH + END_DATE_WIDTH + AAT_STATUS_WIDTH; - -export const STATUS_LIST = ['Planned', 'Pitched', 'Won', 'Lost']; - -export const AAT_STATUS_LIST = ['Active', 'Passive', 'Abandoned']; - -// Imitate Streamy entities. - -// Just a non-trivial object. Nothing fancy or correct. -export class CustomDate { - year: number; - month: number; - day: number; - - constructor(y: number, m: number, d: number) { - this.year = y; - this.month = m; - this.day = d; - } - - addDays(days: number): CustomDate { - let newDay = this.day + days; - const newMonth = this.month + Math.floor(newDay / 30); - newDay = newDay % 30; - const newYear = this.year + Math.floor(newMonth / 12); - return new CustomDate(newYear, newMonth, newDay); - } - - static now(): CustomDate { - return new CustomDate(2014, 1, 28); - } -} - -export class RawEntity { - private _data: Map; - - constructor() { - this._data = new Map(); - } - - get(key: string) { - if (key.indexOf('.') == -1) { - return this._data[key]; - } - const pieces = key.split('.'); - const last = pieces[pieces.length - 1]; - pieces.length = pieces.length - 1; - const target = this._resolve(pieces, this); - if (target == null) { - return null; - } - return target[last]; - } - - set(key: string, value) { - if (key.indexOf('.') == -1) { - this._data[key] = value; - return; - } - const pieces = key.split('.'); - const last = pieces[pieces.length - 1]; - pieces.length = pieces.length - 1; - const target = this._resolve(pieces, this); - target[last] = value; - } - - remove(key: string) { - if (!StringWrapper.contains(key, '.')) { - return this._data.delete(key); - } - const pieces = key.split('.'); - const last = pieces[pieces.length - 1]; - pieces.length = pieces.length - 1; - const target = this._resolve(pieces, this); - return target.remove(last); - } - - private _resolve(pieces, start) { - let cur = start; - for (let i = 0; i < pieces.length; i++) { - cur = cur[pieces[i]]; - if (cur == null) { - return null; - } - } - return cur; - } -} - -export class Company extends RawEntity { - get name(): string { - return this.get('name'); - } - set name(val: string) { - this.set('name', val); - } -} - -export class Offering extends RawEntity { - get name(): string { - return this.get('name'); - } - set name(val: string) { - this.set('name', val); - } - - get company(): Company { - return this.get('company'); - } - set company(val: Company) { - this.set('company', val); - } - - get opportunity(): Opportunity { - return this.get('opportunity'); - } - set opportunity(val: Opportunity) { - this.set('opportunity', val); - } - - get account(): Account { - return this.get('account'); - } - set account(val: Account) { - this.set('account', val); - } - - get basePoints(): number { - return this.get('basePoints'); - } - set basePoints(val: number) { - this.set('basePoints', val); - } - - get kickerPoints(): number { - return this.get('kickerPoints'); - } - set kickerPoints(val: number) { - this.set('kickerPoints', val); - } - - get status(): string { - return this.get('status'); - } - set status(val: string) { - this.set('status', val); - } - - get bundles(): string { - return this.get('bundles'); - } - set bundles(val: string) { - this.set('bundles', val); - } - - get dueDate(): CustomDate { - return this.get('dueDate'); - } - set dueDate(val: CustomDate) { - this.set('dueDate', val); - } - - get endDate(): CustomDate { - return this.get('endDate'); - } - set endDate(val: CustomDate) { - this.set('endDate', val); - } - - get aatStatus(): string { - return this.get('aatStatus'); - } - set aatStatus(val: string) { - this.set('aatStatus', val); - } -} - -export class Opportunity extends RawEntity { - get name(): string { - return this.get('name'); - } - set name(val: string) { - this.set('name', val); - } -} - -export class Account extends RawEntity { - get accountId(): number { - return this.get('accountId'); - } - set accountId(val: number) { - this.set('accountId', val); - } -} diff --git a/modules/benchmarks/src/old/naive_infinite_scroll/index.html b/modules/benchmarks/src/old/naive_infinite_scroll/index.html deleted file mode 100644 index 496ab0aa3c5c..000000000000 --- a/modules/benchmarks/src/old/naive_infinite_scroll/index.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - AngularDart Scrolling Benchmark - - -
- App size:
- Iteration count:
- Scroll increment:
-
-
- - -
- Loading... - - $SCRIPTS$ - - diff --git a/modules/benchmarks/src/old/naive_infinite_scroll/index.ts b/modules/benchmarks/src/old/naive_infinite_scroll/index.ts deleted file mode 100644 index da5738b53ab1..000000000000 --- a/modules/benchmarks/src/old/naive_infinite_scroll/index.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {NgModule} from '@angular/core'; -import {BrowserModule} from '@angular/platform-browser'; -import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; - -import {App} from './app'; - -@NgModule({imports: [BrowserModule], bootstrap: [App]}) -class AppModule { -} - -export function main() { - platformBrowserDynamic().bootstrapModule(AppModule); -} diff --git a/modules/benchmarks/src/old/naive_infinite_scroll/random_data.ts b/modules/benchmarks/src/old/naive_infinite_scroll/random_data.ts deleted file mode 100644 index f44e4f543713..000000000000 --- a/modules/benchmarks/src/old/naive_infinite_scroll/random_data.ts +++ /dev/null @@ -1,82 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {AAT_STATUS_LIST, Account, Company, CustomDate, Offering, Opportunity, STATUS_LIST} from './common'; - -export function generateOfferings(count: number): Offering[] { - const res = []; - for (let i = 0; i < count; i++) { - res.push(generateOffering(i)); - } - return res; -} - -export function generateOffering(seed: number): Offering { - const res = new Offering(); - res.name = generateName(seed++); - res.company = generateCompany(seed++); - res.opportunity = generateOpportunity(seed++); - res.account = generateAccount(seed++); - res.basePoints = seed % 10; - res.kickerPoints = seed % 4; - res.status = STATUS_LIST[seed % STATUS_LIST.length]; - res.bundles = randomString(seed++); - res.dueDate = randomDate(seed++); - res.endDate = randomDate(seed++, res.dueDate); - res.aatStatus = AAT_STATUS_LIST[seed % AAT_STATUS_LIST.length]; - return res; -} - -export function generateCompany(seed: number): Company { - const res = new Company(); - res.name = generateName(seed); - return res; -} - -export function generateOpportunity(seed: number): Opportunity { - const res = new Opportunity(); - res.name = generateName(seed); - return res; -} - -export function generateAccount(seed: number): Account { - const res = new Account(); - res.accountId = seed; - return res; -} - -const names = [ - 'Foo', 'Bar', 'Baz', 'Qux', 'Quux', 'Garply', 'Waldo', 'Fred', 'Plugh', 'Xyzzy', 'Thud', 'Cruft', - 'Stuff' -]; - -function generateName(seed: number): string { - return names[seed % names.length]; -} - -const offsets = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; - -function randomDate(seed: number, minDate: CustomDate = null): CustomDate { - if (minDate == null) { - minDate = CustomDate.now(); - } - - return minDate.addDays(offsets[seed % offsets.length]); -} - -const stringLengths = [5, 7, 9, 11, 13]; -const charCodeOffsets = [0, 1, 2, 3, 4, 5, 6, 7, 8]; - -function randomString(seed: number): string { - const len = stringLengths[seed % 5]; - let str = ''; - for (let i = 0; i < len; i++) { - str += StringWrapper.fromCharCode(97 + charCodeOffsets[seed % 9] + i); - } - return str; -} diff --git a/modules/benchmarks/src/old/naive_infinite_scroll/scroll_area.ts b/modules/benchmarks/src/old/naive_infinite_scroll/scroll_area.ts deleted file mode 100644 index dc2c506e84ee..000000000000 --- a/modules/benchmarks/src/old/naive_infinite_scroll/scroll_area.ts +++ /dev/null @@ -1,74 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {NgFor} from '@angular/common'; -import {Component, Directive} from '@angular/core'; - -import {HEIGHT, ITEM_HEIGHT, ITEMS, Offering, ROW_WIDTH, VIEW_PORT_HEIGHT, VISIBLE_ITEMS} from './common'; -import {generateOfferings} from './random_data'; -import {ScrollItemComponent} from './scroll_item'; - -@Component({ - selector: 'scroll-area', - directives: [ScrollItemComponent, NgFor], - template: ` -
-
-
-
- - -
-
-
` -}) -export class ScrollAreaComponent { - private _fullList: Offering[]; - visibleItems: Offering[]; - - viewPortHeight: number; - paddingDiv; - innerDiv; - - constructor() { - this._fullList = generateOfferings(ITEMS); - this.visibleItems = []; - this.viewPortHeight = VIEW_PORT_HEIGHT; - this.onScroll(null); - } - - onScroll(evt) { - let scrollTop = 0; - if (evt != null) { - const scrollDiv = evt.target; - if (this.paddingDiv == null) { - this.paddingDiv = scrollDiv.querySelector('#padding'); - } - if (this.innerDiv == null) { - this.innerDiv = scrollDiv.querySelector('#inner'); - this.innerDiv.style.setProperty('width', `${ROW_WIDTH}px`); - } - scrollTop = scrollDiv.scrollTop; - } - const iStart = Math.floor(scrollTop / ITEM_HEIGHT); - const iEnd = Math.min(iStart + VISIBLE_ITEMS + 1, this._fullList.length); - const padding = iStart * ITEM_HEIGHT; - if (this.innerDiv != null) { - this.innerDiv.style.setProperty('height', `${HEIGHT - padding}px`); - } - if (this.paddingDiv != null) { - this.paddingDiv.style.setProperty('height', `${padding}px`); - } - this.visibleItems = this._fullList.slice(iStart, iEnd); - } -} diff --git a/modules/benchmarks/src/old/naive_infinite_scroll/scroll_item.ts b/modules/benchmarks/src/old/naive_infinite_scroll/scroll_item.ts deleted file mode 100644 index c77ba24f462d..000000000000 --- a/modules/benchmarks/src/old/naive_infinite_scroll/scroll_item.ts +++ /dev/null @@ -1,103 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {Component, Directive} from '@angular/core'; - -import {AccountCellComponent, CompanyNameComponent, FormattedCellComponent, OfferingNameComponent, OpportunityNameComponent, StageButtonsComponent} from './cells'; -import {AAT_STATUS_WIDTH, ACCOUNT_CELL_WIDTH, BASE_POINTS_WIDTH, BUNDLES_WIDTH, COMPANY_NAME_WIDTH, DUE_DATE_WIDTH, END_DATE_WIDTH, ITEM_HEIGHT, KICKER_POINTS_WIDTH, Offering, OFFERING_NAME_WIDTH, OPPORTUNITY_NAME_WIDTH, STAGE_BUTTONS_WIDTH} from './common'; - -@Component({ - selector: 'scroll-item', - inputs: ['offering'], - directives: [ - CompanyNameComponent, OpportunityNameComponent, OfferingNameComponent, StageButtonsComponent, - AccountCellComponent, FormattedCellComponent - ], - template: ` -
- - - - - - - - - - - - - - - - - - - - - - -
` -}) -export class ScrollItemComponent { - offering: Offering; - - itemHeight: number; - - constructor() { - this.itemHeight = ITEM_HEIGHT; - } - - get companyNameWidth() { - return COMPANY_NAME_WIDTH; - } - get opportunityNameWidth() { - return OPPORTUNITY_NAME_WIDTH; - } - get offeringNameWidth() { - return OFFERING_NAME_WIDTH; - } - get accountCellWidth() { - return ACCOUNT_CELL_WIDTH; - } - get basePointsWidth() { - return BASE_POINTS_WIDTH; - } - get kickerPointsWidth() { - return KICKER_POINTS_WIDTH; - } - get stageButtonsWidth() { - return STAGE_BUTTONS_WIDTH; - } - get bundlesWidth() { - return BUNDLES_WIDTH; - } - get dueDateWidth() { - return DUE_DATE_WIDTH; - } - get endDateWidth() { - return END_DATE_WIDTH; - } - get aatStatusWidth() { - return AAT_STATUS_WIDTH; - } -} diff --git a/modules/benchmarks/src/old/page_load/page_load.html b/modules/benchmarks/src/old/page_load/page_load.html deleted file mode 100644 index 86fc4742b2be..000000000000 --- a/modules/benchmarks/src/old/page_load/page_load.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - -

Angular2 page load benchmark

- -
- -
- -$SCRIPTS$ - - diff --git a/modules/benchmarks/src/old/page_load/page_load.ts b/modules/benchmarks/src/old/page_load/page_load.ts deleted file mode 100644 index b2a2d99d7a5d..000000000000 --- a/modules/benchmarks/src/old/page_load/page_load.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {BrowserModule} from '@angular/platform-browser'; -import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; -import {Component, NgModule} from 'angular2/core'; - -@Component({selector: 'app', template: '

Page Load Time

'}) -class App { -} - -@NgModule({ - imports: [BrowserModule], - bootstrap: [App], -}) -class AppModule { -} - -platformBrowserDynamic().bootstrapModule(App).then(() => { - (window).loadTime = Date.now() - performance.timing.navigationStart; - (window).someConstant = 1234567890; -}); diff --git a/modules/benchmarks/src/tree/incremental_dom/BUILD.bazel b/modules/benchmarks/src/tree/incremental_dom/BUILD.bazel deleted file mode 100644 index 4bb49c81f576..000000000000 --- a/modules/benchmarks/src/tree/incremental_dom/BUILD.bazel +++ /dev/null @@ -1,51 +0,0 @@ -load("//tools:defaults.bzl", "app_bundle", "http_server", "ts_library") -load("@npm//@angular/build-tooling/bazel/benchmark/component_benchmark:benchmark_test.bzl", "benchmark_test") -load("//modules/benchmarks:e2e_test.bzl", "e2e_test") - -package(default_visibility = ["//modules/benchmarks:__subpackages__"]) - -ts_library( - name = "incremental_dom", - srcs = glob(["*.ts"]), - tsconfig = "//modules/benchmarks:tsconfig-build.json", - deps = [ - "//modules/benchmarks/src:util_lib", - "//modules/benchmarks/src/tree:util_lib", - "@npm//@types/node", - ], -) - -app_bundle( - name = "bundle", - entry_point = ":index.ts", - deps = [":incremental_dom"], -) - -# The script needs to be called `app_bundle` for easier syncing into g3. -genrule( - name = "app_bundle", - srcs = [":bundle.debug.min.js"], - outs = ["app_bundle.js"], - cmd = "cp $< $@", -) - -http_server( - name = "devserver", - srcs = [ - "index.html", - "@npm//:node_modules/incremental-dom/dist/incremental-dom.js", - ], - deps = [":app_bundle"], -) - -benchmark_test( - name = "perf", - server = ":devserver", - deps = ["//modules/benchmarks/src/tree:perf_tests_lib"], -) - -e2e_test( - name = "e2e", - server = ":devserver", - deps = ["//modules/benchmarks/src/tree:e2e_tests_lib"], -) diff --git a/modules/benchmarks/src/tree/incremental_dom/index.html b/modules/benchmarks/src/tree/incremental_dom/index.html deleted file mode 100644 index 3e33e7be5aef..000000000000 --- a/modules/benchmarks/src/tree/incremental_dom/index.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - -

Params

-
- Depth: - -
- -
- -

Incremental-Dom Tree Benchmark

-

- - - - -

- -
- -
- - - - - - - - - diff --git a/modules/benchmarks/src/tree/incremental_dom/index.ts b/modules/benchmarks/src/tree/incremental_dom/index.ts deleted file mode 100644 index 934e938b5353..000000000000 --- a/modules/benchmarks/src/tree/incremental_dom/index.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {bindAction, profile} from '../../util'; -import {buildTree, emptyTree, initTreeUtils} from '../util'; - -import {TreeComponent} from './tree'; - -let tree: TreeComponent; - -function destroyDom() { - tree.data = emptyTree; -} - -function createDom() { - tree.data = buildTree(); -} - -function noop() {} - -function init() { - tree = new TreeComponent(document.querySelector('tree')); - - initTreeUtils(); - - bindAction('#destroyDom', destroyDom); - bindAction('#createDom', createDom); - - bindAction('#updateDomProfile', profile(createDom, noop, 'update')); - bindAction('#createDomProfile', profile(createDom, destroyDom, 'create')); -} - -init(); diff --git a/modules/benchmarks/src/tree/incremental_dom/tree.ts b/modules/benchmarks/src/tree/incremental_dom/tree.ts deleted file mode 100644 index 9a42b4b4a5d1..000000000000 --- a/modules/benchmarks/src/tree/incremental_dom/tree.ts +++ /dev/null @@ -1,43 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {TreeNode} from '../util'; - -// We load "IncrementalDOM" as a AMD global because the "incremental-dom" NPM package does not -// come with a named UMD module, and it's easier to just import the AMD file and use it globally. -declare const IncrementalDOM: any; -const {patch, elementOpen, elementClose, elementOpenStart, elementOpenEnd, text, attr} = - IncrementalDOM; - -export class TreeComponent { - constructor(private _rootEl: any) {} - - set data(data: TreeNode) { - patch(this._rootEl, () => this._render(data)); - } - - private _render(data: TreeNode) { - elementOpenStart('span', '', null); - if (data.depth % 2 === 0) { - attr('style', 'background-color: grey'); - } - elementOpenEnd(); - text(` ${data.value} `); - elementClose('span'); - if (data.left) { - elementOpen('tree', '', null); - this._render(data.left); - elementClose('tree'); - } - if (data.right) { - elementOpen('tree', '', null); - this._render(data.right); - elementClose('tree'); - } - } -} diff --git a/modules/benchmarks/src/tree/iv/BUILD.bazel b/modules/benchmarks/src/tree/iv/BUILD.bazel deleted file mode 100644 index 465120ee67cf..000000000000 --- a/modules/benchmarks/src/tree/iv/BUILD.bazel +++ /dev/null @@ -1,31 +0,0 @@ -load("//tools:defaults.bzl", "http_server") -load("@npm//@angular/build-tooling/bazel/benchmark/component_benchmark:benchmark_test.bzl", "benchmark_test") -load("//modules/benchmarks:e2e_test.bzl", "e2e_test") - -package(default_visibility = ["//modules/benchmarks:__subpackages__"]) - -http_server( - name = "devserver", - srcs = [ - "app_bundle.js", - "index.html", - ], -) - -benchmark_test( - name = "perf", - server = ":devserver", - deps = [ - "//modules/benchmarks/src/tree:detect_changes_perf_tests_lib", - "//modules/benchmarks/src/tree:perf_tests_lib", - ], -) - -e2e_test( - name = "e2e", - server = ":devserver", - deps = [ - "//modules/benchmarks/src/tree:detect_changes_e2e_tests_lib", - "//modules/benchmarks/src/tree:e2e_tests_lib", - ], -) diff --git a/modules/benchmarks/src/tree/iv/app_bundle.js b/modules/benchmarks/src/tree/iv/app_bundle.js deleted file mode 100644 index ebd76e1e2909..000000000000 --- a/modules/benchmarks/src/tree/iv/app_bundle.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -/* tslint:disable */ -// clang-format off -function $nextRef(){return++refCount}function $el(e,n,r,t){var o={kind:"E",index:n,name:r,ref:t?++refCount:0,children:[],props:NO_PROPS,domNode:null};return e.children[e.children.length]=o,o}function $cc(e,n,r,t,o,i){var d=!0===t.$isClassCpt,a={kind:"G",index:n,cm:1,cpt:d?new t:null,render:d?null:t,props:r,changes:null,childChanges:null,ref:i?++refCount:0,children:[],domNode:null,sdGroup:null,ltGroup:null,parent:e,$lastChange:refreshCount,$lastRefresh:refreshCount};if(e.children[e.children.length]=a,a.cpt){var l=a.cpt;l.$node=a,l.$renderer=$iv.renderer,l.props=a.props,l.init&&l.init()}return o?a.ltGroup={kind:"G",index:n,cm:1,cpt:a.cpt,render:a.render,props:a.props,changes:null,childChanges:null,ref:0,children:[],domNode:null,sdGroup:a,ltGroup:null,parent:null,$lastChange:refreshCount,$lastRefresh:refreshCount}:(renderCpt(a),a)}function $cg(e,n,r,t){var o=n.children[e];if(o&&o.index===t)return o.childChanges=null,o;var i={kind:"G",index:t,cm:1,props:{},changes:null,childChanges:null,ref:++refCount,children:[],domNode:null,parent:n,$lastChange:refreshCount,$lastRefresh:refreshCount};return r.cm?n.children[n.children.length]=i:(n.children.splice(e,0,i),addChangeInstruction(i,{kind:"CG",node:i,parent:n,position:e,nextSibling:findNextDomSibling(n,e)})),i}function $lg(e,n){addChildChanges(e,n)}function $dg(e,n,r,t){for(var o=n.children[e];o&&o.indexd;d++)retrieveChanges(t[d],n,r);r&&(e.childChanges=null)}if(o&&o.length){for(var i=n.length,d=0;o.length>d;d++,i++)n[i]=o[d];r&&(e.changes=null)}}function addChangeInstruction(e,n){e.changes?e.changes.splice(e.changes.length,0,n):e.changes=[n],e.$lastChange=refreshCount}function addChildChanges(e,n){(e.changes||e.childChanges)&&(n.childChanges?n.childChanges.push(e):n.childChanges=[e],n.$lastChange=refreshCount)}function findNextDomSibling(e,n,r){void 0===r&&(r=!1);var t,o=e.children;if(n+1d;d++)if(i.children[d]===e)return findNextDomSibling(i,d)}return null}function htmlRenderer(e,n,r){return new Renderer(e,n,r)}function processChanges(e,n,r){for(var t=0,o=e;td;d++)createDomNode(o[d],n,r,t)}function createElementDomNode(e,n,r,t){var o,i,d=e.props,a=e.atts;if(a&&a.xmlns&&(t=a.xmlns),i=t?r.createElementNS(t,e.name):r.createElement(e.name),a)for(var l in a)a.hasOwnProperty(l)&&i.setAttribute(l,a[l]);if(d)if(t&&!t.match(RX_HTML))for(var l in d)d.hasOwnProperty(l)&&i.setAttribute(l,d[l]);else for(var l in d)if(d.hasOwnProperty(l)&&void 0!==(o=d[l]))if(o&&o.$isMap)if("classList"===l){var s=[];a&&(a.class?s.push(a.class):a.className&&s.push(a.className));for(var c in o)o.hasOwnProperty(c)&&"$"!==c[0]&&o[c]&&s.push(c);s.length&&(i.className=s.join(" "))}else"style"===l&&setMapProperties(i.style,o);else o.call?"o"===l[0]&&addEvtListener(i,e,l):i[l]=o;e.domNode=i,n.appendChild(i),processChildNodes(e,i,r,t)}function setMapProperties(e,n){for(var r in n)n.hasOwnProperty(r)&&"$"!==r[0]&&(e[r]=n[r])}function addEvtListener(e,n,r){e.addEventListener(r.substring(2),function(e){n.props[r].call(n,e)})}function removeGroupFromDom(e,n,r){var t,o=e.children,i=e.domNode;if(o){var d=o.length;n&&r&&countGroupDomChildren(e)===i.childNodes.length&&(i.textContent="",n=!1);for(var a=0;d>a;a++)"G"===(t=o[a]).kind?removeGroupFromDom(t,n,!1):"T"!==t.kind&&"E"!==t.kind||n&&t.domNode&&t.domNode.parentNode===i&&i.removeChild(t.domNode)}e.domNode=null}function countGroupDomChildren(e){for(var n,r,t=0,o=e.children,i=o.length,d=0;i>d;d++)"G"===(r=(n=o[d]).kind)?t+=countGroupDomChildren(n):"D"!==r&&t++;return t}function replaceDomNode(e,n,r){if(e!==n&&r.domNode===e&&(r.domNode=n,"G"===r.kind))for(var t=r.children,o=0;t.length>o;o++)replaceDomNode(e,n,t[o])}function getIntParameter(e){return parseInt(getStringParameter(e),10)}function getStringParameter(e){for(var n,r,t=document.querySelectorAll('input[name="'+e+'"]'),o=0;o - - - - - - -

Params

-
- Depth: - -
- -
- -

IV Tree Benchmark

-

- - - - - - -

- -
Change detection runs:
-
- - - - - diff --git a/modules/benchmarks/src/views/BUILD.bazel b/modules/benchmarks/src/views/BUILD.bazel deleted file mode 100644 index d9695ccd625a..000000000000 --- a/modules/benchmarks/src/views/BUILD.bazel +++ /dev/null @@ -1,45 +0,0 @@ -load("//tools:defaults.bzl", "app_bundle", "http_server", "ng_module") - -package(default_visibility = ["//modules/benchmarks:__subpackages__"]) - -ng_module( - name = "application_lib", - srcs = glob( - ["**/*.ts"], - exclude = ["**/*.spec.ts"], - ), - deps = [ - "//packages:types", - "//packages/common", - "//packages/core", - "//packages/platform-browser", - ], -) - -app_bundle( - name = "bundle", - entry_point = ":index.ts", - deps = [ - ":application_lib", - ], -) - -# The script needs to be called `app_bundle` for easier syncing into g3. -genrule( - name = "app_bundle", - srcs = [":bundle.debug.min.js"], - outs = ["app_bundle.js"], - cmd = "cp $< $@", -) - -http_server( - name = "server", - srcs = [ - "index.html", - ], - deps = [ - ":bundle.debug.min.js", - ":bundle.min.js", - "//packages/zone.js/bundles:zone.umd.js", - ], -) diff --git a/modules/benchmarks/src/views/index.html b/modules/benchmarks/src/views/index.html deleted file mode 100644 index c2499d20ee8b..000000000000 --- a/modules/benchmarks/src/views/index.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - -

Views traversal benchmark

- - loading... - - - - diff --git a/modules/benchmarks/src/views/index.ts b/modules/benchmarks/src/views/index.ts deleted file mode 100644 index 5f9460a2383d..000000000000 --- a/modules/benchmarks/src/views/index.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -import {enableProdMode} from '@angular/core'; -import {platformBrowser} from '@angular/platform-browser'; - -import {ViewsBenchmarkModule} from './views-benchmark'; - -enableProdMode(); -platformBrowser().bootstrapModule(ViewsBenchmarkModule); diff --git a/modules/benchmarks/src/views/views-benchmark.ts b/modules/benchmarks/src/views/views-benchmark.ts deleted file mode 100644 index 9cb35cebc476..000000000000 --- a/modules/benchmarks/src/views/views-benchmark.ts +++ /dev/null @@ -1,73 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -import {CommonModule} from '@angular/common'; -import {ChangeDetectorRef, Component, Directive, NgModule, TemplateRef, ViewContainerRef} from '@angular/core'; -import {BrowserModule} from '@angular/platform-browser'; - -@Directive({selector: '[viewManipulationDirective]', exportAs: 'vm'}) -export class ViewManipulationDirective { - constructor(private _vcRef: ViewContainerRef, private _tplRef: TemplateRef) {} - - create(no: number) { - for (let i = 0; i < no; i++) { - this._vcRef.createEmbeddedView(this._tplRef); - } - } - - clear() { - this._vcRef.clear(); - } -} - -@Component({ - selector: 'benchmark-root', - template: ` - -
- - - -
- - -
text
-
- - ` -}) -export class ViewsBenchmark { - items: number[]|undefined = undefined; - - constructor(private _cdRef: ChangeDetectorRef) {} - - create(vm: ViewManipulationDirective) { - vm.create(1000); - } - - destroy(vm: ViewManipulationDirective) { - vm.clear(); - } - - check() { - for (let i = 0; i < 10000; i++) { - this._cdRef.detectChanges(); - } - } -} - -@NgModule({ - declarations: [ViewsBenchmark, ViewManipulationDirective], - imports: [ - CommonModule, - BrowserModule, - ], - bootstrap: [ViewsBenchmark] -}) -export class ViewsBenchmarkModule { -}