refactor(benchpress): delete outdated/unused folder (#35147)

PR Close #35147
This commit is contained in:
Wagner Maciel 2020-02-05 10:48:13 -08:00 committed by Kara Erickson
parent 60471c092f
commit d5d9971c28
9 changed files with 0 additions and 477 deletions

View File

@ -1,44 +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 {verifyNoBrowserErrors} from '@angular/testing/src/e2e_util';
import {runBenchmark} from '@angular/testing/src/perf_util';
describe('ng2 compiler benchmark', function() {
const URL = 'benchmarks/src/compiler/compiler_benchmark.html';
afterEach(verifyNoBrowserErrors);
it('should log withBindings stats', async() => {
browser.sleep(1000);
runBenchmark({
url: URL,
id: 'ng2.compile.withBindings',
params: [{name: 'elements', value: 150, scale: 'linear'}],
work: function() {
browser.executeScript('document.querySelector("#compileWithBindings").click()');
browser.sleep(500);
}
});
});
it('should log noBindings stats', async() => {
browser.sleep(1000);
runBenchmark({
url: URL,
id: 'ng2.compile.noBindings',
params: [{name: 'elements', value: 150, scale: 'linear'}],
work: function() {
browser.executeScript('document.querySelector("#compileNoBindings").click()');
browser.sleep(500);
}
});
});
});

View File

@ -1,47 +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 {verifyNoBrowserErrors} from '@angular/testing/src/e2e_util';
import {runClickBenchmark} from '@angular/testing/src/perf_util';
describe('ng2 cost benchmark', function() {
const URL = 'benchmarks/src/costs/index.html';
// Number of components to create in a single iteration
const benchmarkSize = 200;
afterEach(verifyNoBrowserErrors);
it('should log stats for baseline (plain components)', async() => {
runClickBenchmark({
url: URL,
buttons: ['#reset', '#createPlainComponents'],
id: 'ng2.costs.baseline',
params: [{name: 'size', value: benchmarkSize, scale: 'linear'}]
});
});
it('should log stats for components with decorators', async() => {
runClickBenchmark({
url: URL,
buttons: ['#reset', '#createComponentsWithDirectives'],
id: 'ng2.costs.decorators',
params: [{name: 'size', value: benchmarkSize, scale: 'linear'}]
});
});
it('should log stats for dynamic components', async() => {
runClickBenchmark({
url: URL,
buttons: ['#reset', '#createDynamicComponents'],
id: 'ng2.costs.dynamic',
params: [{name: 'size', value: benchmarkSize, scale: 'linear'}]
});
});
});

View File

@ -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
*/
import {verifyNoBrowserErrors} from '@angular/testing/src/e2e_util';
import {runClickBenchmark} from '@angular/testing/src/perf_util';
describe('ng2 di benchmark', function() {
const URL = 'benchmarks/src/di/di_benchmark.html';
afterEach(verifyNoBrowserErrors);
it('should log the stats for getByToken', async() => {
runClickBenchmark({
url: URL,
buttons: ['#getByToken'],
id: 'ng2.di.getByToken',
params: [{name: 'iterations', value: 20000, scale: 'linear'}],
microMetrics: {'injectAvg': 'avg time for injection (in ms)'},
waitForAngular2: false
});
});
it('should log the stats for getByKey', async() => {
runClickBenchmark({
url: URL,
buttons: ['#getByKey'],
id: 'ng2.di.getByKey',
params: [{name: 'iterations', value: 20000, scale: 'linear'}],
microMetrics: {'injectAvg': 'avg time for injection (in ms)'},
waitForAngular2: false
});
});
it('should log the stats for getChild', async() => {
runClickBenchmark({
url: URL,
buttons: ['#getChild'],
id: 'ng2.di.getChild',
params: [{name: 'iterations', value: 20000, scale: 'linear'}],
microMetrics: {'injectAvg': 'avg time for getChild (in ms)'},
waitForAngular2: false
});
});
it('should log the stats for instantiate', async() => {
runClickBenchmark({
url: URL,
buttons: ['#instantiate'],
id: 'ng2.di.instantiate',
params: [{name: 'iterations', value: 10000, scale: 'linear'}],
microMetrics: {'injectAvg': 'avg time for instantiate (in ms)'},
waitForAngular2: false
});
});
/**
* This benchmark measures the cost of creating a new injector with a mix
* of binding types: Type, unresolved, unflattened.
*/
it('should log the stats for createVariety', async() => {
runClickBenchmark({
url: URL,
buttons: ['#createVariety'],
id: 'ng2.di.createVariety',
params: [{name: 'iterations', value: 10000, scale: 'linear'}],
microMetrics: {'injectAvg': 'avg time for createVariety (in ms)'},
waitForAngular2: false
});
});
/**
* Same as 'createVariety' benchmark but operates on fully resolved bindings.
*/
it('should log the stats for createVarietyResolved', async() => {
runClickBenchmark({
url: URL,
buttons: ['#createVarietyResolved'],
id: 'ng2.di.createVarietyResolved',
params: [{name: 'iterations', value: 10000, scale: 'linear'}],
microMetrics: {'injectAvg': 'avg time for createVarietyResolved (in ms)'},
waitForAngular2: false
});
});
});

View File

@ -1,51 +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 {verifyNoBrowserErrors} from '@angular/testing/src/e2e_util';
import {runClickBenchmark} from '@angular/testing/src/perf_util';
describe('ng2 largetable benchmark', function() {
const URL = 'benchmarks/src/largetable/largetable_benchmark.html';
afterEach(verifyNoBrowserErrors);
// Not yet implemented:
// 'ngBind',
// 'ngBindOnce',
// 'ngBindFn',
// 'ngBindFilter',
// 'interpolationFilter'
['interpolation', 'interpolationAttr', 'interpolationFn'].forEach(function(benchmarkType) {
it('should log the ng stats with: ' + benchmarkType, async() => {
runClickBenchmark({
url: URL,
buttons: ['#ng2DestroyDom', '#ng2CreateDom'],
id: 'ng2.largetable.' + benchmarkType,
params: [
{name: 'rows', value: 20, scale: 'sqrt'}, {name: 'columns', value: 20, scale: 'sqrt'},
{name: 'benchmarkType', value: benchmarkType}
]
});
});
});
it('should log the baseline stats', async() => {
runClickBenchmark({
url: URL,
buttons: ['#baselineDestroyDom', '#baselineCreateDom'],
id: 'baseline.largetable',
params: [
{name: 'rows', value: 100, scale: 'sqrt'}, {name: 'columns', value: 20, scale: 'sqrt'},
{name: 'benchmarkType', value: 'baseline'}
]
});
});
});

View File

@ -1,38 +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 {verifyNoBrowserErrors} from '@angular/testing/src/e2e_util';
import {runBenchmark} from '@angular/testing/src/perf_util';
describe('ng2 naive infinite scroll benchmark', function() {
const URL = 'benchmarks/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, async() => {
runBenchmark({
url: URL,
id: 'ng2.naive_infinite_scroll',
work: function() {
browser.wait(
protractor.until.elementLocated(protractor.By.css('body /deep/ #scrollDiv')), 5000);
$('#reset-btn').click();
$('#run-btn').click();
browser.wait(protractor.until.elementLocated(protractor.By.css('#done')), 10000);
},
params: [
{name: 'appSize', value: appSize}, {name: 'iterationCount', value: 20, scale: 'linear'},
{name: 'scrollIncrement', value: 40}
]
});
});
});
});

View File

@ -1,63 +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 {verifyNoBrowserErrors} from '@angular/testing/src/e2e_util';
import {runClickBenchmark} from '@angular/testing/src/perf_util';
describe('ng2 naive infinite scroll benchmark', function() {
const URL = 'benchmarks/src/naive_infinite_scroll/index.html?appSize=3';
afterEach(verifyNoBrowserErrors);
it('should not throw errors', async() => {
browser.get(URL);
const expectedRowCount = 18;
const expectedCellsPerRow = 27;
const allScrollItems = 'scroll-app #testArea scroll-item';
const cells = `${ allScrollItems } .row *`;
const stageButtons = `${ allScrollItems } .row stage-buttons button`;
const count = function(selector) {
return browser.executeScript(
`return ` +
`document.querySelectorAll("${ selector }").length;`);
};
const clickFirstOf = function(selector) {
return browser.executeScript(`document.querySelector("${ selector }").click();`);
};
const firstTextOf = function(selector) {
return browser.executeScript(
`return ` +
`document.querySelector("${ selector }").innerText;`);
};
// Make sure rows are rendered
count(allScrollItems).then(function(c) { expect(c).toEqual(expectedRowCount); });
// Make sure cells are rendered
count(cells).then(function(c) { expect(c).toEqual(expectedRowCount * expectedCellsPerRow); });
// Click on first enabled button and verify stage changes
firstTextOf(`${ stageButtons }:enabled`).then(function(text) {
expect(text).toEqual('Pitched');
clickFirstOf(`${ stageButtons }:enabled`).then(function() {
firstTextOf(`${ stageButtons }:enabled`).then((text) => expect(text).toEqual('Won'));
});
});
$('#reset-btn').click();
$('#run-btn').click();
browser.wait(() => {
return $('#done').getText().then(function() { return true; }, function() { return false; });
}, 10000);
});
});

View File

@ -1,45 +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 {verifyNoBrowserErrors} from 'angular2/src/testing/perf_util';
describe('ng2 largetable benchmark', function() {
const URL = 'benchmarks/src/page_load/page_load.html';
const runner = global['benchpressRunner'];
afterEach(verifyNoBrowserErrors);
it('should log the load time', async() => {
runner
.sample({
id: 'loadTime',
prepare: null,
microMetrics: null,
userMetrics:
{loadTime: 'The time in milliseconds to bootstrap', someConstant: 'Some constant'},
bindings: [
benchpress.bind(benchpress.SizeValidator.SAMPLE_SIZE).toValue(2),
benchpress.bind(benchpress.RegressionSlopeValidator.SAMPLE_SIZE).toValue(2),
benchpress.bind(benchpress.RegressionSlopeValidator.METRIC).toValue('someConstant')
],
execute: () => { browser.get(URL); }
})
.then(report => {
expect(report.completeSample.map(val => val.values.someConstant)
.every(v => v === 1234567890))
.toBe(true);
expect(report.completeSample.map(val => val.values.loadTime)
.filter(t => typeof t === 'number' && t > 0)
.length)
.toBeGreaterThan(1);
})
.then(done);
});
});

View File

@ -1,48 +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 {verifyNoBrowserErrors} from '@angular/testing/src/e2e_util';
import {runClickBenchmark} from '@angular/testing/src/perf_util';
describe('ng2 selector benchmark', function() {
const URL = 'benchmarks/src/compiler/selector_benchmark.html';
afterEach(verifyNoBrowserErrors);
it('should log parse stats', async() => {
runClickBenchmark({
url: URL,
buttons: ['#parse'],
id: 'ng2.selector.parse',
params: [{name: 'selectors', value: 10000, scale: 'linear'}],
waitForAngular2: false
});
});
it('should log addSelectable stats', async() => {
runClickBenchmark({
url: URL,
buttons: ['#addSelectable'],
id: 'ng2.selector.addSelectable',
params: [{name: 'selectors', value: 10000, scale: 'linear'}],
waitForAngular2: false
});
});
it('should log match stats', async() => {
runClickBenchmark({
url: URL,
buttons: ['#match'],
id: 'ng2.selector.match',
params: [{name: 'selectors', value: 10000, scale: 'linear'}],
waitForAngular2: false
});
});
});

View File

@ -1,50 +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 {verifyNoBrowserErrors} from '@angular/testing/src/e2e_util';
import {runClickBenchmark} from '@angular/testing/src/perf_util';
describe('ng2 static tree benchmark', function() {
const URL = 'benchmarks/src/static_tree/tree_benchmark.html';
afterEach(verifyNoBrowserErrors);
it('should log the ng stats', async() => {
runClickBenchmark({
url: URL,
buttons: ['#ng2DestroyDom', '#ng2CreateDom'],
id: 'ng2.static.tree.create.plain',
params: []
});
});
it('should log the ng stats (update)', async() => {
runClickBenchmark({
url: URL,
buttons: ['#ng2CreateDom'],
id: 'ng2.static.tree.update',
params: [],
});
});
it('should log the baseline stats', async() => {
runClickBenchmark({
url: URL,
buttons: ['#baselineDestroyDom', '#baselineCreateDom'],
id: 'baseline.static.tree.create',
params: []
});
});
it('should log the baseline stats (update)', async() => {
runClickBenchmark(
{url: URL, buttons: ['#baselineCreateDom'], id: 'baseline.static.tree.update', params: []});
});
});