@ -13,7 +13,7 @@ import {openBrowser, verifyNoBrowserErrors} from '../../../e2e_util/e2e_util';
|
||||
describe('change detection benchmark', () => {
|
||||
afterEach(verifyNoBrowserErrors);
|
||||
|
||||
it(`should render and update`, async() => {
|
||||
it(`should render and update`, async () => {
|
||||
openBrowser({
|
||||
url: '',
|
||||
ignoreBrowserSynchronization: true,
|
||||
|
@ -31,15 +31,14 @@ const UpdateWorker: Worker = {
|
||||
// name. We determine the name of the Bazel package where this test runs from the current test
|
||||
// target. The Bazel target
|
||||
// looks like: "//modules/benchmarks/src/change_detection/{pkg_name}:{target_name}".
|
||||
const testPackageName = process.env['BAZEL_TARGET'] !.split(':')[0].split('/').pop();
|
||||
const testPackageName = process.env['BAZEL_TARGET']!.split(':')[0].split('/').pop();
|
||||
|
||||
describe('change detection benchmark perf', () => {
|
||||
|
||||
afterEach(verifyNoBrowserErrors);
|
||||
|
||||
[UpdateWorker].forEach((worker) => {
|
||||
describe(worker.id, () => {
|
||||
it(`should run benchmark for ${testPackageName}`, async() => {
|
||||
it(`should run benchmark for ${testPackageName}`, async () => {
|
||||
await runChangeDetectionBenchmark({
|
||||
id: `change_detection.${testPackageName}.${worker.id}`,
|
||||
url: '/',
|
||||
|
@ -35,7 +35,9 @@ export function init(moduleRef: NgModuleRef<TransplantedViewsModule>) {
|
||||
appRef.tick();
|
||||
}
|
||||
|
||||
function detectChanges() { appRef.tick(); }
|
||||
function detectChanges() {
|
||||
appRef.tick();
|
||||
}
|
||||
|
||||
function noop() {}
|
||||
}
|
||||
|
@ -40,10 +40,14 @@ export class InsertionComponent {
|
||||
@Input() template !: TemplateRef<{}>;
|
||||
views: any[] = [];
|
||||
@Input()
|
||||
set viewCount(n: number) { this.views = n > 0 ? newArray<any>(n) : []; }
|
||||
set viewCount(n: number) {
|
||||
this.views = n > 0 ? newArray<any>(n) : [];
|
||||
}
|
||||
|
||||
// use trackBy to ensure profile isn't affected by the cost to refresh ngFor.
|
||||
trackByIndex(index: number, item: any) { return index; }
|
||||
trackByIndex(index: number, item: any) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
|
@ -15,7 +15,7 @@ export function newArray<T>(size: number, value: T): T[];
|
||||
export function newArray<T>(size: number, value?: T): T[] {
|
||||
const list: T[] = [];
|
||||
for (let i = 0; i < size; i++) {
|
||||
list.push(value !);
|
||||
list.push(value!);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
Reference in New Issue
Block a user