Skip to content

Commit e77df14

Browse files
AndrewKushnirkirjs
authored andcommitted
Revert "refactor(core): add profiler calls for tne newly introduced events (angular#59233)" (angular#59506)
This reverts commit 435d31e. PR Close angular#59506
1 parent 0bb81c5 commit e77df14

File tree

9 files changed

+21
-200
lines changed

9 files changed

+21
-200
lines changed

packages/core/src/application/application_ref.ts

+1-13
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ import {NgZone} from '../zone/ng_zone';
4747
import {ApplicationInitStatus} from './application_init';
4848
import {TracingAction, TracingService, TracingSnapshot} from './tracing';
4949
import {EffectScheduler} from '../render3/reactivity/root_effect_scheduler';
50-
import {ProfilerEvent} from '../render3/profiler_types';
51-
import {profiler} from '../render3/profiler';
5250

5351
/**
5452
* A DI token that provides a set of callbacks to
@@ -533,8 +531,6 @@ export class ApplicationRef {
533531
componentOrFactory: ComponentFactory<C> | Type<C>,
534532
rootSelectorOrNode?: string | any,
535533
): ComponentRef<C> {
536-
profiler(ProfilerEvent.BootstrapComponentStart);
537-
538534
(typeof ngDevMode === 'undefined' || ngDevMode) && warnIfDestroyed(this._destroyed);
539535
const isComponentFactory = componentOrFactory instanceof ComponentFactory;
540536
const initStatus = this._injector.get(ApplicationInitStatus);
@@ -580,9 +576,6 @@ export class ApplicationRef {
580576
const _console = this._injector.get(Console);
581577
_console.log(`Angular is running in development mode.`);
582578
}
583-
584-
profiler(ProfilerEvent.BootstrapComponentEnd, compRef);
585-
586579
return compRef;
587580
}
588581

@@ -605,8 +598,6 @@ export class ApplicationRef {
605598

606599
/** @internal */
607600
_tick = (): void => {
608-
profiler(ProfilerEvent.ChangeDetectionStart);
609-
610601
if (this.tracingSnapshot !== null) {
611602
const snapshot = this.tracingSnapshot;
612603
this.tracingSnapshot = null;
@@ -631,6 +622,7 @@ export class ApplicationRef {
631622
try {
632623
this._runningTick = true;
633624
this.synchronize();
625+
634626
if (typeof ngDevMode === 'undefined' || ngDevMode) {
635627
for (let view of this.allViews) {
636628
view.checkNoChanges();
@@ -643,8 +635,6 @@ export class ApplicationRef {
643635
this._runningTick = false;
644636
setActiveConsumer(prevConsumer);
645637
this.afterTick.next();
646-
647-
profiler(ProfilerEvent.ChangeDetectionEnd);
648638
}
649639
};
650640

@@ -663,9 +653,7 @@ export class ApplicationRef {
663653

664654
let runs = 0;
665655
while (this.dirtyFlags !== ApplicationRefDirtyFlags.None && runs++ < MAXIMUM_REFRESH_RERUNS) {
666-
profiler(ProfilerEvent.ChangeDetectionSyncStart);
667656
this.synchronizeOnce();
668-
profiler(ProfilerEvent.ChangeDetectionSyncEnd);
669657
}
670658

671659
if ((typeof ngDevMode === 'undefined' || ngDevMode) && runs >= MAXIMUM_REFRESH_RERUNS) {

packages/core/src/application/create_application.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@ import {Type} from '../interface/type';
1313
import {createOrReusePlatformInjector} from '../platform/platform';
1414
import {assertStandaloneComponentType} from '../render3/errors';
1515
import {EnvironmentNgModuleRefAdapter} from '../render3/ng_module_ref';
16+
import {NgZone} from '../zone/ng_zone';
1617

1718
import {_callAndReportToErrorHandler, ApplicationRef} from './application_ref';
1819
import {ChangeDetectionScheduler} from '../change_detection/scheduling/zoneless_scheduling';
1920
import {ChangeDetectionSchedulerImpl} from '../change_detection/scheduling/zoneless_scheduling_impl';
2021
import {bootstrap} from '../platform/bootstrap';
21-
import {profiler} from '../render3/profiler';
22-
import {ProfilerEvent} from '../render3/profiler_types';
2322

2423
/**
2524
* Internal create application API that implements the core application creation logic and optional
@@ -38,7 +37,6 @@ export function internalCreateApplication(config: {
3837
appProviders?: Array<Provider | EnvironmentProviders>;
3938
platformProviders?: Provider[];
4039
}): Promise<ApplicationRef> {
41-
profiler(ProfilerEvent.BootstrapApplicationStart);
4240
try {
4341
const {rootComponent, appProviders, platformProviders} = config;
4442

@@ -71,7 +69,5 @@ export function internalCreateApplication(config: {
7169
});
7270
} catch (e) {
7371
return Promise.reject(e);
74-
} finally {
75-
profiler(ProfilerEvent.BootstrapApplicationEnd);
7672
}
7773
}

packages/core/src/defer/rendering.ts

-6
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ import {
5656
getTDeferBlockDetails,
5757
getTemplateIndexForState,
5858
} from './utils';
59-
import {profiler} from '../render3/profiler';
60-
import {ProfilerEvent} from '../render3/profiler_types';
6159

6260
/**
6361
* **INTERNAL**, avoid referencing it in application code.
@@ -245,8 +243,6 @@ function applyDeferBlockState(
245243
tNode: TNode,
246244
hostLView: LView<unknown>,
247245
) {
248-
profiler(ProfilerEvent.DeferBlockStateStart);
249-
250246
const stateTmplIndex = getTemplateIndexForState(newState, hostLView, tNode);
251247

252248
if (stateTmplIndex !== null) {
@@ -310,8 +306,6 @@ function applyDeferBlockState(
310306
lDetails[ON_COMPLETE_FNS] = null;
311307
}
312308
}
313-
314-
profiler(ProfilerEvent.DeferBlockStateEnd);
315309
}
316310

317311
/**

packages/core/src/render3/after_render/manager.ts

+4-21
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ import {
1717
} from '../../change_detection/scheduling/zoneless_scheduling';
1818
import {type DestroyRef} from '../../linker/destroy_ref';
1919
import {TracingAction, TracingService, TracingSnapshot} from '../../application/tracing';
20-
import {profiler} from '../profiler';
21-
import {ProfilerEvent} from '../profiler_types';
2220

2321
export class AfterRenderManager {
2422
impl: AfterRenderImpl | null = null;
@@ -67,12 +65,6 @@ export class AfterRenderImpl {
6765
* might be scheduled.
6866
*/
6967
execute(): void {
70-
const hasSequencesToExecute = this.sequences.size > 0;
71-
72-
if (hasSequencesToExecute) {
73-
profiler(ProfilerEvent.AfterRenderHooksStart);
74-
}
75-
7668
this.executing = true;
7769
for (const phase of AFTER_RENDER_PHASES) {
7870
for (const sequence of this.sequences) {
@@ -82,15 +74,10 @@ export class AfterRenderImpl {
8274

8375
try {
8476
sequence.pipelinedValue = this.ngZone.runOutsideAngular(() =>
85-
this.maybeTrace(() => {
86-
const hookFn = sequence.hooks[phase]!;
87-
88-
profiler(ProfilerEvent.LifecycleHookStart, null, hookFn);
89-
const value = hookFn(sequence.pipelinedValue);
90-
profiler(ProfilerEvent.LifecycleHookEnd, null, hookFn);
91-
92-
return value;
93-
}, sequence.snapshot),
77+
this.maybeTrace(
78+
() => sequence.hooks[phase]!(sequence.pipelinedValue),
79+
sequence.snapshot,
80+
),
9481
);
9582
} catch (err) {
9683
sequence.erroredOrDestroyed = true;
@@ -118,10 +105,6 @@ export class AfterRenderImpl {
118105
this.scheduler.notify(NotificationSource.DeferredRenderHook);
119106
}
120107
this.deferredRegistrations.clear();
121-
122-
if (hasSequencesToExecute) {
123-
profiler(ProfilerEvent.AfterRenderHooksEnd);
124-
}
125108
}
126109

127110
register(sequence: AfterRenderSequence): void {

packages/core/src/render3/component_ref.ts

-5
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ import {getComponentLViewByIndex, getNativeByTNode, getTNode} from './util/view_
8989
import {ViewRef} from './view_ref';
9090
import {ChainedInjector} from './chained_injector';
9191
import {unregisterLView} from './interfaces/lview_tracking';
92-
import {profiler} from './profiler';
93-
import {ProfilerEvent} from './profiler_types';
9492

9593
export class ComponentFactoryResolver extends AbstractComponentFactoryResolver {
9694
/**
@@ -216,8 +214,6 @@ export class ComponentFactory<T> extends AbstractComponentFactory<T> {
216214
rootSelectorOrNode?: any,
217215
environmentInjector?: NgModuleRef<any> | EnvironmentInjector | undefined,
218216
): AbstractComponentRef<T> {
219-
profiler(ProfilerEvent.DynamicComponentStart);
220-
221217
const prevConsumer = setActiveConsumer(null);
222218
try {
223219
// Check if the component is orphan
@@ -401,7 +397,6 @@ export class ComponentFactory<T> extends AbstractComponentFactory<T> {
401397
unregisterLView(rootLView);
402398
throw e;
403399
} finally {
404-
profiler(ProfilerEvent.DynamicComponentEnd);
405400
leaveView();
406401
}
407402

packages/core/src/render3/instructions/change_detection.ts

-6
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ import {
7070
} from './shared';
7171
import {runEffectsInView} from '../reactivity/view_effect_runner';
7272
import {isDestroyed} from '../interfaces/type_checks';
73-
import {ProfilerEvent} from '../profiler_types';
74-
import {profiler} from '../profiler';
7573

7674
/**
7775
* The maximum number of times the change detection traversal will rerun before throwing an error.
@@ -430,12 +428,8 @@ function detectChangesInComponent(
430428
mode: ChangeDetectionMode,
431429
): void {
432430
ngDevMode && assertEqual(isCreationMode(hostLView), false, 'Should be run in update mode');
433-
profiler(ProfilerEvent.ComponentStart);
434-
435431
const componentView = getComponentLViewByIndex(componentHostIdx, hostLView);
436432
detectChangesInViewIfAttached(componentView, mode);
437-
438-
profiler(ProfilerEvent.ComponentEnd, componentView[CONTEXT] as any as {});
439433
}
440434

441435
/**

packages/core/src/render3/instructions/render.ts

-6
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ import {
2121
TVIEW,
2222
TView,
2323
} from '../interfaces/view';
24-
import {profiler} from '../profiler';
25-
import {ProfilerEvent} from '../profiler_types';
2624
import {enterView, leaveView} from '../state';
2725
import {getComponentLViewByIndex, isCreationMode} from '../util/view_utils';
2826

@@ -40,11 +38,7 @@ export function renderComponent(hostLView: LView, componentHostIdx: number) {
4038
componentView[HYDRATION] = retrieveHydrationInfo(hostRNode, componentView[INJECTOR]);
4139
}
4240

43-
profiler(ProfilerEvent.ComponentStart);
44-
4541
renderView(componentTView, componentView, componentView[CONTEXT]);
46-
47-
profiler(ProfilerEvent.ComponentEnd, componentView[CONTEXT] as any as {});
4842
}
4943

5044
/**

packages/core/src/render3/instructions/shared.ts

-3
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,7 @@ export function processHostBindingOpCodes(tView: TView, lView: LView): void {
182182
const hostBindingFn = hostBindingOpCodes[++i] as HostBindingsFunction<any>;
183183
setBindingRootForHostBindings(bindingRootIndx, directiveIdx);
184184
const context = lView[directiveIdx];
185-
186-
profiler(ProfilerEvent.HostBindingsUpdateStart, context);
187185
hostBindingFn(RenderFlags.Update, context);
188-
profiler(ProfilerEvent.HostBindingsUpdateEnd, context);
189186
}
190187
}
191188
} finally {

0 commit comments

Comments
 (0)