diff --git a/modules/benchmarks/src/tree/ng1/BUILD.bazel b/modules/benchmarks/src/tree/ng1/BUILD.bazel deleted file mode 100644 index 57256e0fe3b..00000000000 --- a/modules/benchmarks/src/tree/ng1/BUILD.bazel +++ /dev/null @@ -1,58 +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 = "ng1", - srcs = glob(["*.ts"]), - tsconfig = "//modules/benchmarks:tsconfig-build.json", - deps = [ - "//modules/benchmarks/src:util_lib", - "//modules/benchmarks/src/tree:util_lib", - ], -) - -app_bundle( - name = "bundle", - entry_point = ":index.ts", - deps = [":ng1"], -) - -# 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/angular-1.8/angular.js", - ], - deps = [ - ":app_bundle", - ], -) - -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/ng1/index.html b/modules/benchmarks/src/tree/ng1/index.html deleted file mode 100644 index 7d50f4f32f1..00000000000 --- a/modules/benchmarks/src/tree/ng1/index.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - -

Params

-
- Depth: - -
- -
- -

Ng1 Tree Benchmark

-

- - - - - - -

- -
Change detection runs:
-
- Loading... -
- - - - - - - - - diff --git a/modules/benchmarks/src/tree/ng1/index.ts b/modules/benchmarks/src/tree/ng1/index.ts deleted file mode 100644 index 14732150cc5..00000000000 --- a/modules/benchmarks/src/tree/ng1/index.ts +++ /dev/null @@ -1,59 +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 {addTreeToModule} from './tree'; - -declare var angular: any; - -function init() { - let detectChangesRuns = 0; - const numberOfChecksEl = document.getElementById('numberOfChecks')!; - - addTreeToModule(angular.module('app', [])).run([ - '$rootScope', - ($rootScope: any) => { - function detectChanges() { - for (let i = 0; i < 10; i++) { - $rootScope.$digest(); - } - detectChangesRuns += 10; - numberOfChecksEl.textContent = `${detectChangesRuns}`; - } - - function noop() {} - - function destroyDom() { - $rootScope.$apply(() => { - $rootScope.initData = emptyTree; - }); - } - - function createDom() { - $rootScope.$apply(() => { - $rootScope.initData = buildTree(); - }); - } - - initTreeUtils(); - - bindAction('#destroyDom', destroyDom); - bindAction('#createDom', createDom); - bindAction('#detectChanges', detectChanges); - bindAction('#detectChangesProfile', profile(detectChanges, noop, 'detectChanges')); - bindAction('#updateDomProfile', profile(createDom, noop, 'update')); - bindAction('#createDomProfile', profile(createDom, destroyDom, 'create')); - } - ]); - - angular.bootstrap(document.querySelector('tree'), ['app']); -} - -init(); diff --git a/modules/benchmarks/src/tree/ng1/tree.ts b/modules/benchmarks/src/tree/ng1/tree.ts deleted file mode 100644 index 8315119871c..00000000000 --- a/modules/benchmarks/src/tree/ng1/tree.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 {TreeNode} from '../util'; - -declare var angular: any; - -export function addTreeToModule(mod: any): any { - return mod - .directive( - 'tree', - function() { - return { - scope: {data: '='}, - template: - ` {{data.value}} ` - }; - }) - // special directive for "if" as angular 1.3 does not support - // recursive components. - // Cloned from real ngIf directive, but using a lazily created transclude function. - .directive( - 'treeIf', - [ - '$compile', '$animate', - function($compile: any, $animate: any) { - let transcludeFn: any; - return { - transclude: 'element', - priority: 600, - terminal: true, - $$tlb: true, - link: function($scope: any, $element: any, $attr: any, ctrl: any) { - if (!transcludeFn) { - const template = ''; - transcludeFn = $compile(template); - } - let childElement: any, childScope: any; - $scope.$watch($attr.data, function ngIfWatchAction(value: any) { - if (value) { - if (!childScope) { - childScope = $scope.$new(); - transcludeFn(childScope, function(clone: any) { - childElement = clone; - $animate.enter(clone, $element.parent(), $element); - }); - } - } else { - if (childScope) { - childScope.$destroy(); - childScope = null; - } - if (childElement) { - $animate.leave(childElement); - childElement = null; - } - } - }); - } - }; - } - ]) - .config([ - '$compileProvider', - function($compileProvider: any) { - $compileProvider.debugInfoEnabled(false); - } - ]); -}