How does ng.profiler.timeChangeDetection() work?

Viewed 1255

I am looking at ng.profiler.timeChangeDetection() to help profile an Angular application. However, there are some things which remain unclear.

When I run ng.profiler.timeChangeDetection({ record: true }) from the console, I get an output that looks something like this.

common_tools.ts:64 ran 15 change detection cycles common_tools.ts:65 34.61 ms per check Profile 'Change Detection' started. Profile 'Change Detection' finished. ChangeDetectionPerfRecord {msPerTick: 34.61200000019744, numTicks: 15}

If I profile chrome and then enter ng.profiler.timeChangeDetection({ record: true }) via chrome dev tools console, I see something like this.

enter image description here

So I can see that it appeared to profile change detection, but from what point?

The docs (https://angular.io/api/platform-browser/enableDebugTools) show how to run the command but they do not go into much detail as to what is actually happening. I am looking for some clarity in regards to..

  1. What does running ng.profiler.timeChangeDetection({ record: true }) actually do?
  2. Does ng.profiler.timeChangeDetection({ record: true }) emulate a page refresh?
  3. Does it trigger change detection throughout the whole application?
  4. At what point are changes being tracked? It tells me that there were 15 change detection cycles, but what event triggered those cycles?
0 Answers
Related