Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions dev-infra/ts-circular-dependencies/analyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import * as ts from 'typescript';
import {getFileStatus} from './file_system';
import {getModuleReferences} from './parser';

export type ModuleResolver = (specifier: string) => string | null;
export type ModuleResolver = (specifier: string) => string|null;

/**
* Reference chains describe a sequence of source files which are connected through imports.
Expand Down Expand Up @@ -69,7 +69,7 @@ export class Analyzer {
getSourceFile(filePath: string): ts.SourceFile {
const resolvedPath = resolve(filePath);
if (this._sourceFileCache.has(resolvedPath)) {
return this._sourceFileCache.get(resolvedPath) !;
return this._sourceFileCache.get(resolvedPath)!;
}
const fileContent = readFileSync(resolvedPath, 'utf8');
const sourceFile =
Expand Down Expand Up @@ -105,7 +105,7 @@ export class Analyzer {
if (!this.unresolvedFiles.has(originFilePath)) {
this.unresolvedFiles.set(originFilePath, [specifier]);
}
this.unresolvedFiles.get(originFilePath) !.push(specifier);
this.unresolvedFiles.get(originFilePath)!.push(specifier);
}

/** Resolves the given import specifier to the corresponding source file. */
Expand Down
4 changes: 3 additions & 1 deletion dev-infra/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,6 @@ export function getAngularDevConfig<K, T>(): DevInfraConfig<K, T> {
* Interface exressing the expected structure of the DevInfraConfig.
* Allows for providing a typing for a part of the config to read.
*/
export interface DevInfraConfig<K, T> { [K: string]: T; }
export interface DevInfraConfig<K, T> {
[K: string]: T;
}
2 changes: 1 addition & 1 deletion goldens/public-api/core/core.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,7 @@ export declare function ɵɵstyleSanitizer(sanitizer: StyleSanitizeFn | null): v

export declare function ɵɵtemplate(index: number, templateFn: ComponentTemplate<any> | null, decls: number, vars: number, tagName?: string | null, attrsIndex?: number | null, localRefsIndex?: number | null, localRefExtractor?: LocalRefExtractor): void;

export declare function ɵɵtemplateRefExtractor(tNode: TNode, currentView: ɵangular_packages_core_core_bp): TemplateRef<unknown> | null;
export declare function ɵɵtemplateRefExtractor(tNode: TNode, currentView: ɵangular_packages_core_core_bo): TemplateRef<unknown> | null;

export declare function ɵɵtext(index: number, value?: string): void;

Expand Down
138 changes: 70 additions & 68 deletions modules/benchmarks/src/bootstrap_ng2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,77 +8,79 @@

(function(global: any) {

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()');
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()');

(<any>global).benchmarksBootstrap = benchmarksBootstrap;
(<any>global).benchmarksBootstrap = benchmarksBootstrap;

function benchmarksBootstrap() {
// check query param
const useBundles = location.search.indexOf('bundles=false') == -1;
if (useBundles) {
System.config({
defaultJSExtensions: true,
map: {
'@angular/core': '/packages-dist/core/bundles/core.umd.js',
'@angular/animations': '/packages-dist/common/bundles/animations.umd.js',
'@angular/platform-browser/animations':
'/packages-dist/platform-browser/bundles/platform-browser-animations.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',
'rxjs': '/all/benchmarks/vendor/rxjs',
},
packages: {
'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!');
function benchmarksBootstrap() {
// check query param
const useBundles = location.search.indexOf('bundles=false') == -1;
if (useBundles) {
System.config({
defaultJSExtensions: true,
map: {
'@angular/core': '/packages-dist/core/bundles/core.umd.js',
'@angular/animations': '/packages-dist/common/bundles/animations.umd.js',
'@angular/platform-browser/animations':
'/packages-dist/platform-browser/bundles/platform-browser-animations.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',
'rxjs': '/all/benchmarks/vendor/rxjs',
},
packages: {
'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({
defaultJSExtensions: true,
map: {'@angular': '/all/@angular', 'rxjs': '/all/benchmarks/vendor/rxjs'},
packages: {
'@angular/core': {main: 'index.js', defaultExtension: 'js'},
'@angular/animations': {main: 'index.js', defaultExtension: 'js'},
'@angular/platform-browser/animations': {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) { m.main(); }, console.error.bind(console));
System.config({
defaultJSExtensions: true,
map: {'@angular': '/all/@angular', 'rxjs': '/all/benchmarks/vendor/rxjs'},
packages: {
'@angular/core': {main: 'index.js', defaultExtension: 'js'},
'@angular/animations': {main: 'index.js', defaultExtension: 'js'},
'@angular/platform-browser/animations': {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'},
}
});
}

function writeScriptTag(scriptUrl: string, onload?: string) {
document.write(`<script src="${scriptUrl}" onload="${onload}"></script>`);
}
// BOOTSTRAP the app!
System.import('index').then(function(m: any) {
m.main();
}, console.error.bind(console));
}

function writeScriptTag(scriptUrl: string, onload?: string) {
document.write(`<script src="${scriptUrl}" onload="${onload}"></script>`);
}
}(window));
32 changes: 16 additions & 16 deletions modules/benchmarks/src/bootstrap_plain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,24 @@

(function(global: any) {

writeScriptTag('/all/benchmarks/vendor/core.js');
writeScriptTag('/all/benchmarks/vendor/system.src.js', 'benchmarksBootstrap()');
writeScriptTag('/all/benchmarks/vendor/core.js');
writeScriptTag('/all/benchmarks/vendor/system.src.js', 'benchmarksBootstrap()');

(<any>global).benchmarksBootstrap = benchmarksBootstrap;
(<any>global).benchmarksBootstrap = benchmarksBootstrap;

function benchmarksBootstrap() {
System.config({
defaultJSExtensions: true,
map: {'incremental-dom': '/all/benchmarks/vendor/incremental-dom-cjs.js'}
});
function benchmarksBootstrap() {
System.config({
defaultJSExtensions: true,
map: {'incremental-dom': '/all/benchmarks/vendor/incremental-dom-cjs.js'}
});

// BOOTSTRAP the app!
System.import('index').then(function(m: any) {
m.main && m.main();
}, console.error.bind(console));
}
// BOOTSTRAP the app!
System.import('index').then(function(m: any) {
m.main && m.main();
}, console.error.bind(console));
}

function writeScriptTag(scriptUrl: string, onload?: string) {
document.write(`<script src="${scriptUrl}" onload="${onload}"></script>`);
}
function writeScriptTag(scriptUrl: string, onload?: string) {
document.write(`<script src="${scriptUrl}" onload="${onload}"></script>`);
}
}(window));
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: '/',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ export function init(moduleRef: NgModuleRef<TransplantedViewsModule>) {
appRef.tick();
}

function detectChanges() { appRef.tick(); }
function detectChanges() {
appRef.tick();
}

function noop() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion modules/benchmarks/src/change_detection/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
8 changes: 6 additions & 2 deletions modules/benchmarks/src/class_bindings/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,16 @@ export class AppComponent {
}
}

create() { this.show = true; }
create() {
this.show = true;
}

update() {
this.msg = this.msg === 'hello' ? 'bye' : 'hello';
this.list[0].text = this.msg;
}

destroy() { this.show = false; }
destroy() {
this.show = false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import {$, browser} from 'protractor';
import {runBenchmark} from '../../../e2e_util/perf_util';

describe('class bindings perf', () => {

it('should work for update', async() => {
it('should work for update', async () => {
browser.rootEl = '#root';
await runBenchmark({
id: 'create',
Expand All @@ -23,7 +22,7 @@ describe('class bindings perf', () => {
});
});

it('should work for update', async() => {
it('should work for update', async () => {
browser.rootEl = '#root';
await runBenchmark({
id: 'update',
Expand All @@ -34,5 +33,4 @@ describe('class bindings perf', () => {
work: () => $('#update').click()
});
});

});
29 changes: 21 additions & 8 deletions modules/benchmarks/src/expanding_rows/benchmark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,32 @@ import {BenchmarkableExpandingRowModule} from './benchmarkable_expanding_row_mod
</benchmark-area>`,
})
export class InitializationRoot implements AfterViewInit {
@ViewChild(BenchmarkableExpandingRow, {static: true})
expandingRow !: BenchmarkableExpandingRow;
@ViewChild(BenchmarkableExpandingRow, {static: true}) expandingRow!: BenchmarkableExpandingRow;

ngAfterViewInit() {}

reset() { this.expandingRow.reset(); }
reset() {
this.expandingRow.reset();
}

init() { this.expandingRow.init(); }
init() {
this.expandingRow.init();
}

async runAll() {
await execTimed('initialization_benchmark', async() => { await this.doInit(); });
await execTimed('initialization_benchmark', async () => {
await this.doInit();
});
}

async handleInitClick() { await this.doInit(); }
async handleInitClick() {
await this.doInit();
}

private async doInit() {
await execTimed('initial_load', async() => { this.expandingRow.init(); });
await execTimed('initial_load', async () => {
this.expandingRow.init();
});
}
}

Expand All @@ -74,5 +83,9 @@ export async function execTimed(description: string, func: () => Promise<void>)
}

export async function nextTick(delay = 1) {
return new Promise((res, rej) => { setTimeout(() => { res(); }, delay); });
return new Promise((res, rej) => {
setTimeout(() => {
res();
}, delay);
});
}
Loading