@ -6,28 +6,23 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {CompilerConfig, DirectiveResolver} from '@angular/compiler';
|
||||
import {Component, ComponentResolver, Directive, ViewContainerRef,} from '@angular/core';
|
||||
import {ViewMetadata} from '@angular/core/src/metadata/view';
|
||||
import {PromiseWrapper} from '@angular/facade/src/async';
|
||||
import {Type, print} from '@angular/facade/src/lang';
|
||||
import {print, Type} from '@angular/facade/src/lang';
|
||||
import {bootstrap} from '@angular/platform-browser';
|
||||
import {BrowserDomAdapter} from '@angular/platform-browser/src/browser/browser_adapter';
|
||||
import {DOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
|
||||
import {ComponentResolver, Component, Directive, ViewContainerRef,} from '@angular/core';
|
||||
|
||||
import {ViewMetadata} from '@angular/core/src/metadata/view';
|
||||
|
||||
import {CompilerConfig, DirectiveResolver} from '@angular/compiler';
|
||||
|
||||
import {getIntParameter, bindAction} from '@angular/testing/src/benchmark_util';
|
||||
import {bindAction, getIntParameter} from '@angular/testing/src/benchmark_util';
|
||||
|
||||
function _createBindings(): any[] {
|
||||
const multiplyTemplatesBy = getIntParameter('elements');
|
||||
return [
|
||||
{
|
||||
provide: DirectiveResolver,
|
||||
useFactory:
|
||||
() => new MultiplyDirectiveResolver(
|
||||
multiplyTemplatesBy, [BenchmarkComponentNoBindings, BenchmarkComponentWithBindings]),
|
||||
useFactory: () => new MultiplyDirectiveResolver(
|
||||
multiplyTemplatesBy, [BenchmarkComponentNoBindings, BenchmarkComponentWithBindings]),
|
||||
deps: []
|
||||
},
|
||||
// Use interpretative mode as Dart does not support JIT and
|
||||
@ -57,7 +52,9 @@ function measureWrapper(func, desc) {
|
||||
const elapsedMs = new Date().getTime() - begin.getTime();
|
||||
print(`[${desc}] ...done, took ${elapsedMs} ms`);
|
||||
};
|
||||
const onError = function(e) { DOM.logError(e); };
|
||||
const onError = function(e) {
|
||||
DOM.logError(e);
|
||||
};
|
||||
PromiseWrapper.then(func(), onSuccess, onError);
|
||||
};
|
||||
}
|
||||
|
@ -47,7 +47,9 @@ export function main() {
|
||||
function match() {
|
||||
let matchCount = 0;
|
||||
for (let i = 0; i < count; i++) {
|
||||
fixedMatcher.match(fixedSelectors[i][0], (selector, selected) => { matchCount += selected; });
|
||||
fixedMatcher.match(fixedSelectors[i][0], (selector, selected) => {
|
||||
matchCount += selected;
|
||||
});
|
||||
}
|
||||
return matchCount;
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import {NgFor, NgIf} from '@angular/common';
|
||||
import {Component, Directive, DynamicComponentLoader, ViewContainerRef} from '@angular/core';
|
||||
import {ApplicationRef} from '@angular/core/src/application_ref';
|
||||
import {ListWrapper} from '@angular/facade/src/lang';
|
||||
import {BrowserModule, bootstrap} from '@angular/platform-browser';
|
||||
import {bootstrap, BrowserModule} from '@angular/platform-browser';
|
||||
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
|
||||
import {bindAction, getIntParameter} from '@angular/testing/src/benchmark_util';
|
||||
|
||||
@ -89,7 +89,9 @@ class AppComponent {
|
||||
testingWithDirectives: boolean;
|
||||
testingDynamicComponents: boolean;
|
||||
|
||||
constructor() { this.reset(); }
|
||||
constructor() {
|
||||
this.reset();
|
||||
}
|
||||
|
||||
reset(): void {
|
||||
this.list = [];
|
||||
|
@ -98,30 +98,42 @@ export function main() {
|
||||
|
||||
@Injectable()
|
||||
class A {
|
||||
constructor() { count++; }
|
||||
constructor() {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
class B {
|
||||
constructor(a: A) { count++; }
|
||||
constructor(a: A) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
class C {
|
||||
constructor(b: B) { count++; }
|
||||
constructor(b: B) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
class D {
|
||||
constructor(c: C, b: B) { count++; }
|
||||
constructor(c: C, b: B) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
class E {
|
||||
constructor(d: D, c: C) { count++; }
|
||||
constructor(d: D, c: C) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
class F {
|
||||
constructor(e: E, d: D) { count++; }
|
||||
constructor(e: E, d: D) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,9 @@ export class App {
|
||||
for (let i = 0; i < appSize; i++) {
|
||||
this.scrollAreas.push(i);
|
||||
}
|
||||
bindAction('#run-btn', () => { this.runBenchmark(); });
|
||||
bindAction('#run-btn', () => {
|
||||
this.runBenchmark();
|
||||
});
|
||||
bindAction('#reset-btn', () => {
|
||||
this._getScrollDiv().scrollTop = 0;
|
||||
const existingMarker = this._locateFinishedMarker();
|
||||
@ -88,7 +90,11 @@ export class App {
|
||||
}, 0);
|
||||
}
|
||||
|
||||
private _locateFinishedMarker() { return DOM.querySelector(document.body, '#done'); }
|
||||
private _locateFinishedMarker() {
|
||||
return DOM.querySelector(document.body, '#done');
|
||||
}
|
||||
|
||||
private _getScrollDiv() { return DOM.query('body /deep/ #scrollDiv'); }
|
||||
private _getScrollDiv() {
|
||||
return DOM.query('body /deep/ #scrollDiv');
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,9 @@ export class HasStyle {
|
||||
|
||||
constructor() {}
|
||||
|
||||
set width(w: number) { this.cellWidth = w; }
|
||||
set width(w: number) {
|
||||
this.cellWidth = w;
|
||||
}
|
||||
}
|
||||
|
||||
@Component({
|
||||
@ -74,7 +76,9 @@ export class StageButtonsComponent extends HasStyle {
|
||||
private _offering: Offering;
|
||||
stages: Stage[];
|
||||
|
||||
get offering(): Offering { return this._offering; }
|
||||
get offering(): Offering {
|
||||
return this._offering;
|
||||
}
|
||||
|
||||
set offering(offering: Offering) {
|
||||
this._offering = offering;
|
||||
|
@ -56,13 +56,17 @@ export class CustomDate {
|
||||
return new CustomDate(newYear, newMonth, newDay);
|
||||
}
|
||||
|
||||
static now(): CustomDate { return new CustomDate(2014, 1, 28); }
|
||||
static now(): CustomDate {
|
||||
return new CustomDate(2014, 1, 28);
|
||||
}
|
||||
}
|
||||
|
||||
export class RawEntity {
|
||||
private _data: Map<any, any>;
|
||||
|
||||
constructor() { this._data = new Map(); }
|
||||
constructor() {
|
||||
this._data = new Map();
|
||||
}
|
||||
|
||||
get(key: string) {
|
||||
if (key.indexOf('.') == -1) {
|
||||
@ -114,51 +118,107 @@ export class RawEntity {
|
||||
}
|
||||
|
||||
export class Company extends RawEntity {
|
||||
get name(): string { return this.get('name'); }
|
||||
set name(val: string) { this.set('name', val); }
|
||||
get name(): string {
|
||||
return this.get('name');
|
||||
}
|
||||
set name(val: string) {
|
||||
this.set('name', val);
|
||||
}
|
||||
}
|
||||
|
||||
export class Offering extends RawEntity {
|
||||
get name(): string { return this.get('name'); }
|
||||
set name(val: string) { this.set('name', val); }
|
||||
get name(): string {
|
||||
return this.get('name');
|
||||
}
|
||||
set name(val: string) {
|
||||
this.set('name', val);
|
||||
}
|
||||
|
||||
get company(): Company { return this.get('company'); }
|
||||
set company(val: Company) { this.set('company', val); }
|
||||
get company(): Company {
|
||||
return this.get('company');
|
||||
}
|
||||
set company(val: Company) {
|
||||
this.set('company', val);
|
||||
}
|
||||
|
||||
get opportunity(): Opportunity { return this.get('opportunity'); }
|
||||
set opportunity(val: Opportunity) { this.set('opportunity', val); }
|
||||
get opportunity(): Opportunity {
|
||||
return this.get('opportunity');
|
||||
}
|
||||
set opportunity(val: Opportunity) {
|
||||
this.set('opportunity', val);
|
||||
}
|
||||
|
||||
get account(): Account { return this.get('account'); }
|
||||
set account(val: Account) { this.set('account', val); }
|
||||
get account(): Account {
|
||||
return this.get('account');
|
||||
}
|
||||
set account(val: Account) {
|
||||
this.set('account', val);
|
||||
}
|
||||
|
||||
get basePoints(): number { return this.get('basePoints'); }
|
||||
set basePoints(val: number) { this.set('basePoints', val); }
|
||||
get basePoints(): number {
|
||||
return this.get('basePoints');
|
||||
}
|
||||
set basePoints(val: number) {
|
||||
this.set('basePoints', val);
|
||||
}
|
||||
|
||||
get kickerPoints(): number { return this.get('kickerPoints'); }
|
||||
set kickerPoints(val: number) { this.set('kickerPoints', val); }
|
||||
get kickerPoints(): number {
|
||||
return this.get('kickerPoints');
|
||||
}
|
||||
set kickerPoints(val: number) {
|
||||
this.set('kickerPoints', val);
|
||||
}
|
||||
|
||||
get status(): string { return this.get('status'); }
|
||||
set status(val: string) { this.set('status', val); }
|
||||
get status(): string {
|
||||
return this.get('status');
|
||||
}
|
||||
set status(val: string) {
|
||||
this.set('status', val);
|
||||
}
|
||||
|
||||
get bundles(): string { return this.get('bundles'); }
|
||||
set bundles(val: string) { this.set('bundles', val); }
|
||||
get bundles(): string {
|
||||
return this.get('bundles');
|
||||
}
|
||||
set bundles(val: string) {
|
||||
this.set('bundles', val);
|
||||
}
|
||||
|
||||
get dueDate(): CustomDate { return this.get('dueDate'); }
|
||||
set dueDate(val: CustomDate) { this.set('dueDate', val); }
|
||||
get dueDate(): CustomDate {
|
||||
return this.get('dueDate');
|
||||
}
|
||||
set dueDate(val: CustomDate) {
|
||||
this.set('dueDate', val);
|
||||
}
|
||||
|
||||
get endDate(): CustomDate { return this.get('endDate'); }
|
||||
set endDate(val: CustomDate) { this.set('endDate', val); }
|
||||
get endDate(): CustomDate {
|
||||
return this.get('endDate');
|
||||
}
|
||||
set endDate(val: CustomDate) {
|
||||
this.set('endDate', val);
|
||||
}
|
||||
|
||||
get aatStatus(): string { return this.get('aatStatus'); }
|
||||
set aatStatus(val: string) { this.set('aatStatus', val); }
|
||||
get aatStatus(): string {
|
||||
return this.get('aatStatus');
|
||||
}
|
||||
set aatStatus(val: string) {
|
||||
this.set('aatStatus', val);
|
||||
}
|
||||
}
|
||||
|
||||
export class Opportunity extends RawEntity {
|
||||
get name(): string { return this.get('name'); }
|
||||
set name(val: string) { this.set('name', val); }
|
||||
get name(): string {
|
||||
return this.get('name');
|
||||
}
|
||||
set name(val: string) {
|
||||
this.set('name', val);
|
||||
}
|
||||
}
|
||||
|
||||
export class Account extends RawEntity {
|
||||
get accountId(): number { return this.get('accountId'); }
|
||||
set accountId(val: number) { this.set('accountId', val); }
|
||||
get accountId(): number {
|
||||
return this.get('accountId');
|
||||
}
|
||||
set accountId(val: number) {
|
||||
this.set('accountId', val);
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
import {NgFor} from '@angular/common';
|
||||
import {Component, Directive} from '@angular/core';
|
||||
|
||||
import {HEIGHT, ITEMS, ITEM_HEIGHT, Offering, ROW_WIDTH, VIEW_PORT_HEIGHT, VISIBLE_ITEMS} from './common';
|
||||
import {HEIGHT, ITEM_HEIGHT, ITEMS, Offering, ROW_WIDTH, VIEW_PORT_HEIGHT, VISIBLE_ITEMS} from './common';
|
||||
import {generateOfferings} from './random_data';
|
||||
import {ScrollItemComponent} from './scroll_item';
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
import {Component, Directive} from '@angular/core';
|
||||
|
||||
import {AccountCellComponent, CompanyNameComponent, FormattedCellComponent, OfferingNameComponent, OpportunityNameComponent, StageButtonsComponent} from './cells';
|
||||
import {AAT_STATUS_WIDTH, ACCOUNT_CELL_WIDTH, BASE_POINTS_WIDTH, BUNDLES_WIDTH, COMPANY_NAME_WIDTH, DUE_DATE_WIDTH, END_DATE_WIDTH, ITEM_HEIGHT, KICKER_POINTS_WIDTH, OFFERING_NAME_WIDTH, OPPORTUNITY_NAME_WIDTH, Offering, STAGE_BUTTONS_WIDTH} from './common';
|
||||
import {AAT_STATUS_WIDTH, ACCOUNT_CELL_WIDTH, BASE_POINTS_WIDTH, BUNDLES_WIDTH, COMPANY_NAME_WIDTH, DUE_DATE_WIDTH, END_DATE_WIDTH, ITEM_HEIGHT, KICKER_POINTS_WIDTH, Offering, OFFERING_NAME_WIDTH, OPPORTUNITY_NAME_WIDTH, STAGE_BUTTONS_WIDTH} from './common';
|
||||
|
||||
@Component({
|
||||
selector: 'scroll-item',
|
||||
@ -63,17 +63,41 @@ export class ScrollItemComponent {
|
||||
|
||||
itemHeight: number;
|
||||
|
||||
constructor() { this.itemHeight = ITEM_HEIGHT; }
|
||||
constructor() {
|
||||
this.itemHeight = ITEM_HEIGHT;
|
||||
}
|
||||
|
||||
get companyNameWidth() { return COMPANY_NAME_WIDTH; }
|
||||
get opportunityNameWidth() { return OPPORTUNITY_NAME_WIDTH; }
|
||||
get offeringNameWidth() { return OFFERING_NAME_WIDTH; }
|
||||
get accountCellWidth() { return ACCOUNT_CELL_WIDTH; }
|
||||
get basePointsWidth() { return BASE_POINTS_WIDTH; }
|
||||
get kickerPointsWidth() { return KICKER_POINTS_WIDTH; }
|
||||
get stageButtonsWidth() { return STAGE_BUTTONS_WIDTH; }
|
||||
get bundlesWidth() { return BUNDLES_WIDTH; }
|
||||
get dueDateWidth() { return DUE_DATE_WIDTH; }
|
||||
get endDateWidth() { return END_DATE_WIDTH; }
|
||||
get aatStatusWidth() { return AAT_STATUS_WIDTH; }
|
||||
get companyNameWidth() {
|
||||
return COMPANY_NAME_WIDTH;
|
||||
}
|
||||
get opportunityNameWidth() {
|
||||
return OPPORTUNITY_NAME_WIDTH;
|
||||
}
|
||||
get offeringNameWidth() {
|
||||
return OFFERING_NAME_WIDTH;
|
||||
}
|
||||
get accountCellWidth() {
|
||||
return ACCOUNT_CELL_WIDTH;
|
||||
}
|
||||
get basePointsWidth() {
|
||||
return BASE_POINTS_WIDTH;
|
||||
}
|
||||
get kickerPointsWidth() {
|
||||
return KICKER_POINTS_WIDTH;
|
||||
}
|
||||
get stageButtonsWidth() {
|
||||
return STAGE_BUTTONS_WIDTH;
|
||||
}
|
||||
get bundlesWidth() {
|
||||
return BUNDLES_WIDTH;
|
||||
}
|
||||
get dueDateWidth() {
|
||||
return DUE_DATE_WIDTH;
|
||||
}
|
||||
get endDateWidth() {
|
||||
return END_DATE_WIDTH;
|
||||
}
|
||||
get aatStatusWidth() {
|
||||
return AAT_STATUS_WIDTH;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user