From 446b51e16409266018a45cf60ba59fb6c9a9f4f2 Mon Sep 17 00:00:00 2001 From: Wagner Maciel Date: Tue, 25 Feb 2020 12:17:56 -0800 Subject: [PATCH] refactor(benchpress): delete unused code (#35670) PR Close #35670 --- modules/benchmarks_external/README.md | 6 - .../e2e_test/compiler_perf.ts | 37 ------ .../e2e_test/largetable_perf.ts | 33 ----- .../e2e_test/naive_infinite_scroll_perf.ts | 41 ------ .../e2e_test/react_tree_perf.ts | 37 ------ .../e2e_test/static_tree_perf.ts | 37 ------ .../benchmarks_external/e2e_test/tree_perf.ts | 37 ------ modules/benchmarks_external/src/bootstrap.ts | 91 -------------- .../src/compiler/compiler_benchmark.html | 53 -------- .../src/compiler/compiler_benchmark.ts | 117 ----------------- modules/benchmarks_external/src/index.html | 26 ---- .../largetable/largetable-js-template.html | 58 --------- .../src/largetable/largetable_benchmark.html | 98 --------------- .../src/largetable/largetable_benchmark.ts | 119 ------------------ .../src/naive_infinite_scroll/index.html | 20 --- .../naive_infinite_scroll/scroll_area.html | 13 -- .../naive_infinite_scroll/scroll_item.html | 45 ------- .../src/static_tree/tree_benchmark.html | 17 --- .../src/static_tree/tree_benchmark.ts | 77 ------------ .../src/tree/react/index.html | 23 ---- .../src/tree/react/index.ts | 73 ----------- .../src/tree/react/react.min.d.ts | 3 - .../src/tree/tree_benchmark.html | 25 ---- .../src/tree/tree_benchmark.ts | 107 ---------------- 24 files changed, 1193 deletions(-) delete mode 100644 modules/benchmarks_external/README.md delete mode 100644 modules/benchmarks_external/e2e_test/compiler_perf.ts delete mode 100644 modules/benchmarks_external/e2e_test/largetable_perf.ts delete mode 100644 modules/benchmarks_external/e2e_test/naive_infinite_scroll_perf.ts delete mode 100644 modules/benchmarks_external/e2e_test/react_tree_perf.ts delete mode 100644 modules/benchmarks_external/e2e_test/static_tree_perf.ts delete mode 100644 modules/benchmarks_external/e2e_test/tree_perf.ts delete mode 100644 modules/benchmarks_external/src/bootstrap.ts delete mode 100644 modules/benchmarks_external/src/compiler/compiler_benchmark.html delete mode 100644 modules/benchmarks_external/src/compiler/compiler_benchmark.ts delete mode 100644 modules/benchmarks_external/src/index.html delete mode 100644 modules/benchmarks_external/src/largetable/largetable-js-template.html delete mode 100644 modules/benchmarks_external/src/largetable/largetable_benchmark.html delete mode 100644 modules/benchmarks_external/src/largetable/largetable_benchmark.ts delete mode 100644 modules/benchmarks_external/src/naive_infinite_scroll/index.html delete mode 100644 modules/benchmarks_external/src/naive_infinite_scroll/scroll_area.html delete mode 100644 modules/benchmarks_external/src/naive_infinite_scroll/scroll_item.html delete mode 100644 modules/benchmarks_external/src/static_tree/tree_benchmark.html delete mode 100644 modules/benchmarks_external/src/static_tree/tree_benchmark.ts delete mode 100644 modules/benchmarks_external/src/tree/react/index.html delete mode 100644 modules/benchmarks_external/src/tree/react/index.ts delete mode 100644 modules/benchmarks_external/src/tree/react/react.min.d.ts delete mode 100644 modules/benchmarks_external/src/tree/tree_benchmark.html delete mode 100644 modules/benchmarks_external/src/tree/tree_benchmark.ts diff --git a/modules/benchmarks_external/README.md b/modules/benchmarks_external/README.md deleted file mode 100644 index 9479c5cd49..0000000000 --- a/modules/benchmarks_external/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# How to run the benchmarks_external locally - -$ cp -r ./modules/benchmarks_external ./dist/all/ -$ ./node_modules/.bin/tsc -p modules --emitDecoratorMetadata -w -$ gulp serve -$ open http://localhost:8000/all/benchmarks_external/src/tree/index.html?bundles=false diff --git a/modules/benchmarks_external/e2e_test/compiler_perf.ts b/modules/benchmarks_external/e2e_test/compiler_perf.ts deleted file mode 100644 index 50efb856be..0000000000 --- a/modules/benchmarks_external/e2e_test/compiler_perf.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * @license - * Copyright Google Inc. 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 {runClickBenchmark, verifyNoBrowserErrors} from '@angular/testing/src/perf_util'; - -describe('ng1.x compiler benchmark', function() { - - const URL = 'benchmarks_external/src/compiler/compiler_benchmark.html'; - - afterEach(verifyNoBrowserErrors); - - it('should log withBinding stats', function(done) { - runClickBenchmark({ - url: URL, - buttons: ['#compileWithBindings'], - id: 'ng1.compile.withBindings', - params: [{name: 'elements', value: 150, scale: 'linear'}], - waitForAngular2: false - }).then(done, done.fail); - }); - - it('should log noBindings stats', function(done) { - runClickBenchmark({ - url: URL, - buttons: ['#compileNoBindings'], - id: 'ng1.compile.noBindings', - params: [{name: 'elements', value: 150, scale: 'linear'}], - waitForAngular2: false - }).then(done, done.fail); - }); - -}); diff --git a/modules/benchmarks_external/e2e_test/largetable_perf.ts b/modules/benchmarks_external/e2e_test/largetable_perf.ts deleted file mode 100644 index c62d19abfa..0000000000 --- a/modules/benchmarks_external/e2e_test/largetable_perf.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * @license - * Copyright Google Inc. 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 {runClickBenchmark, verifyNoBrowserErrors} from '@angular/testing/src/perf_util'; - -describe('ng1.x largetable benchmark', function() { - const URL = 'benchmarks_external/src/largetable/largetable_benchmark.html'; - - afterEach(verifyNoBrowserErrors); - - ['baselineBinding', 'baselineInterpolation', 'ngBind', 'ngBindOnce', 'interpolation', - 'interpolationAttr', 'ngBindFn', 'interpolationFn', 'ngBindFilter', 'interpolationFilter'] - .forEach(function(benchmarkType) { - it('should log the stats with: ' + benchmarkType, function(done) { - runClickBenchmark({ - url: URL, - buttons: ['#destroyDom', '#createDom'], - id: 'ng1.largetable.' + benchmarkType, - params: [ - {name: 'columns', value: 100, scale: 'sqrt'}, - {name: 'rows', value: 20, scale: 'sqrt'}, - {name: 'benchmarkType', value: benchmarkType} - ], - waitForAngular2: false - }).then(done, done.fail); - }); - }); -}); diff --git a/modules/benchmarks_external/e2e_test/naive_infinite_scroll_perf.ts b/modules/benchmarks_external/e2e_test/naive_infinite_scroll_perf.ts deleted file mode 100644 index 7f1e02dfe5..0000000000 --- a/modules/benchmarks_external/e2e_test/naive_infinite_scroll_perf.ts +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @license - * Copyright Google Inc. 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 {runBenchmark, verifyNoBrowserErrors} from '@angular/testing/src/perf_util'; - -describe('ng-dart1.x naive infinite scroll benchmark', function() { - - const URL = 'benchmarks_external/src/naive_infinite_scroll/index.html'; - - afterEach(verifyNoBrowserErrors); - - [1, 2, 4].forEach(function(appSize) { - it('should run scroll benchmark and collect stats for appSize = ' + appSize, function(done) { - runBenchmark({ - url: URL, - id: 'ng1-dart1.x.naive_infinite_scroll', - work: function() { - $('#reset-btn').click(); - $('#run-btn').click(); - let s = 1000; - if (appSize > 4) { - s = s + appSize * 100; - } - browser.sleep(s); - }, - params: [ - {name: 'appSize', value: appSize}, - {name: 'iterationCount', value: 20, scale: 'linear'}, - {name: 'scrollIncrement', value: 40} - ], - waitForAngular2: false - }).then(done, done.fail); - }); - }); - -}); diff --git a/modules/benchmarks_external/e2e_test/react_tree_perf.ts b/modules/benchmarks_external/e2e_test/react_tree_perf.ts deleted file mode 100644 index 3313250616..0000000000 --- a/modules/benchmarks_external/e2e_test/react_tree_perf.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * @license - * Copyright Google Inc. 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 {runClickBenchmark, verifyNoBrowserErrors} from '@angular/testing/src/perf_util'; - -describe('react tree benchmark', function() { - - const URL = 'benchmarks_external/src/tree/react/index.html'; - - afterEach(verifyNoBrowserErrors); - - it('should log the stats (create)', function(done) { - runClickBenchmark({ - url: URL, - buttons: ['#destroyDom', '#createDom'], - id: 'react.tree.create', - params: [{name: 'depth', value: 9, scale: 'log2'}], - waitForAngular2: false - }).then(done, done.fail); - }); - - it('should log the stats (update)', function(done) { - runClickBenchmark({ - url: URL, - buttons: ['#createDom'], - id: 'react.tree.update', - params: [{name: 'depth', value: 9, scale: 'log2'}], - waitForAngular2: false - }).then(done, done.fail); - }); - -}); diff --git a/modules/benchmarks_external/e2e_test/static_tree_perf.ts b/modules/benchmarks_external/e2e_test/static_tree_perf.ts deleted file mode 100644 index 6d26c0cd90..0000000000 --- a/modules/benchmarks_external/e2e_test/static_tree_perf.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * @license - * Copyright Google Inc. 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 {runClickBenchmark, verifyNoBrowserErrors} from '@angular/testing/src/perf_util'; - -describe('ng1.x tree benchmark', function() { - - const URL = 'benchmarks_external/src/static_tree/tree_benchmark.html'; - - afterEach(verifyNoBrowserErrors); - - it('should log the stats (create)', function(done) { - runClickBenchmark({ - url: URL, - buttons: ['#destroyDom', '#createDom'], - id: 'ng1.static.tree.create', - params: [], - waitForAngular2: false - }).then(done, done.fail); - }); - - it('should log the stats (update)', function(done) { - runClickBenchmark({ - url: URL, - buttons: ['#createDom'], - id: 'ng1.static.tree.update', - params: [], - waitForAngular2: false - }).then(done, done.fail); - }); - -}); diff --git a/modules/benchmarks_external/e2e_test/tree_perf.ts b/modules/benchmarks_external/e2e_test/tree_perf.ts deleted file mode 100644 index 54e0f94536..0000000000 --- a/modules/benchmarks_external/e2e_test/tree_perf.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * @license - * Copyright Google Inc. 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 {runClickBenchmark, verifyNoBrowserErrors} from '@angular/testing/src/perf_util'; - -describe('ng1.x tree benchmark', function() { - - const URL = 'benchmarks_external/src/tree/tree_benchmark.html'; - - afterEach(verifyNoBrowserErrors); - - it('should log the stats (create)', function(done) { - runClickBenchmark({ - url: URL, - buttons: ['#destroyDom', '#createDom'], - id: 'ng1.tree.create', - params: [{name: 'depth', value: 9, scale: 'log2'}], - waitForAngular2: false - }).then(done, done.fail); - }); - - it('should log the stats (update)', function(done) { - runClickBenchmark({ - url: URL, - buttons: ['#createDom'], - id: 'ng1.tree.update', - params: [{name: 'depth', value: 9, scale: 'log2'}], - waitForAngular2: false - }).then(done, done.fail); - }); - -}); diff --git a/modules/benchmarks_external/src/bootstrap.ts b/modules/benchmarks_external/src/bootstrap.ts deleted file mode 100644 index 20fef436da..0000000000 --- a/modules/benchmarks_external/src/bootstrap.ts +++ /dev/null @@ -1,91 +0,0 @@ -/** - * @license - * Copyright Google Inc. 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 - */ - - -(function(global: any /** TODO #9100 */) { - - writeScriptTag('/all/benchmarks/vendor/core.js'); - writeScriptTag('/all/benchmarks/vendor/zone.js'); - writeScriptTag('/all/benchmarks/vendor/long-stack-trace-zone.js'); - writeScriptTag('/all/benchmarks/vendor/system.src.js'); - writeScriptTag('/all/benchmarks/vendor/Reflect.js', 'benchmarksBootstrap()'); - - (global).benchmarksBootstrap = benchmarksBootstrap; - - function benchmarksBootstrap() { - // check query param - const useBundles = location.search.indexOf('bundles=false') == -1; - if (useBundles) { - System.config({ - map: { - 'index': 'index.js', - '@angular/core': '/packages-dist/core/bundles/core.umd.js', - '@angular/common': '/packages-dist/common/bundles/common.umd.js', - '@angular/forms': '/packages-dist/forms/bundles/forms.umd.js', - '@angular/compiler': '/packages-dist/compiler/bundles/compiler.umd.js', - '@angular/platform-browser': - '/packages-dist/platform-browser/bundles/platform-browser.umd.js', - '@angular/platform-browser-dynamic': - '/packages-dist/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js', - '@angular/http': '/packages-dist/http/bundles/http.umd.js', - '@angular/upgrade': '/packages-dist/upgrade/bundles/upgrade.umd.js', - '@angular/router': '/packages-dist/router/bundles/router.umd.js', - '@angular/core/src/facade': '/all/@angular/core/src/facade', - 'rxjs': 'node_modules/rxjs', - }, - packages: { - 'app': {defaultExtension: 'js'}, - '@angular/core/src/facade': {defaultExtension: 'js'}, - 'rxjs/ajax': {main: 'index.js', defaultExtension: 'js' }, - 'rxjs/operators': {main: 'index.js', defaultExtension: 'js' }, - 'rxjs/testing': {main: 'index.js', defaultExtension: 'js' }, - 'rxjs/websocket': {main: 'index.js', defaultExtension: 'js' }, - 'rxjs': { main: 'index.js', defaultExtension: 'js' }, - } - }); - } else { - console.warn( - 'Not using the Angular bundles. Don\'t use this configuration for e2e/performance tests!'); - - System.config({ - map: { - 'index': 'index.js', - '@angular': '/all/@angular', - 'rxjs': 'node_modules/rxjs', - }, - packages: { - 'app': {defaultExtension: 'js'}, - '@angular/core': {main: 'index.js', defaultExtension: 'js'}, - '@angular/compiler': {main: 'index.js', defaultExtension: 'js'}, - '@angular/router': {main: 'index.js', defaultExtension: 'js'}, - '@angular/common': {main: 'index.js', defaultExtension: 'js'}, - '@angular/forms': {main: 'index.js', defaultExtension: 'js'}, - '@angular/platform-browser': {main: 'index.js', defaultExtension: 'js'}, - '@angular/platform-browser-dynamic': {main: 'index.js', defaultExtension: 'js'}, - '@angular/upgrade': {main: 'index.js', defaultExtension: 'js'}, - 'rxjs/ajax': {main: 'index.js', defaultExtension: 'js' }, - 'rxjs/operators': {main: 'index.js', defaultExtension: 'js' }, - 'rxjs/testing': {main: 'index.js', defaultExtension: 'js' }, - 'rxjs/websocket': {main: 'index.js', defaultExtension: 'js' }, - 'rxjs': { main: 'index.js', defaultExtension: 'js' }, - } - }); - } - - - // BOOTSTRAP the app! - System.import('index').then(function(m: any /** TODO #9100 */) { - m.main(); - }, console.error.bind(console)); - } - - - function writeScriptTag(scriptUrl: any /** TODO #9100 */, onload?: any /** TODO #9100 */) { - document.write(``); - } -}(window)); diff --git a/modules/benchmarks_external/src/compiler/compiler_benchmark.html b/modules/benchmarks_external/src/compiler/compiler_benchmark.html deleted file mode 100644 index 30929d4478..0000000000 --- a/modules/benchmarks_external/src/compiler/compiler_benchmark.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - -

Params

-
- Elements: - -
- -
- -

Actions

-

- - -

- - - - - -$SCRIPTS$ - - - \ No newline at end of file diff --git a/modules/benchmarks_external/src/compiler/compiler_benchmark.ts b/modules/benchmarks_external/src/compiler/compiler_benchmark.ts deleted file mode 100644 index fddeca1e35..0000000000 --- a/modules/benchmarks_external/src/compiler/compiler_benchmark.ts +++ /dev/null @@ -1,117 +0,0 @@ -/** - * @license - * Copyright Google Inc. 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 - */ - -// compiler benchmark in AngularJS 1.x -import {getIntParameter, bindAction} from '@angular/testing/src/benchmark_util'; -declare var angular: any; - -export function main() { - const ngEl = document.createElement('div'); - angular.bootstrap(ngEl, ['app']); -} - -function loadTemplate(templateId, repeatCount) { - const template = document.querySelectorAll(`#${templateId}`)[0]; - const content = (template).innerHTML; - let result = ''; - for (let i = 0; i < repeatCount; i++) { - result += content; - } - // replace [] binding syntax - result = result.replace(/[\[\]]/g, ''); - - // Use a DIV as container as Angular 1.3 does not know