Intelligent Assistant
Chat with our virtual assistant to get answers promptly.


Web Page Loading Process | Key Trace |
|---|---|
Tap event | From the last DispatchTouchEvent to the component initialization. |
Web component initialization | From NWebImpl|CreateNWeb to the time before navigation process |
Navigation process | From NavigationControllorImpl::LoadURLWithParams to the end of NavigationBodyLoader::OnStartLoadingResponseBody. |
DOM and CSS parsing | CSSParserImpl::parseStyleSheet and ParseHTML, excluding HTMLDocumentParser::RunScriptsForPausedTreeBuilder. |
JS compilation and execution | EvaluateScript and v8.callFunction. |
Waiting for downloading network resources | Before ThrottlingURLLoader::OnReceiveResponse of the main render thread. |
End of a touch event response | NotifyFrameSwapped, UnloadOldFrame or the first SkiaOutputSurfaceImplOnGpu::SwapBuffers. |
Rendering | ThreadProxy::BeginMainFrame, excluding v8.callFunction. |
Rasterization and synthesis | From the start of ProxyImpl::NotifyReadyToCommitOnImpl to the end of SwapBuffers. |
End of a completion latency | The last SkiaOutputSurfaceImplOnGpu::SwapBuffers. |
For details about how to use DevEco Profiler to analyze frame freezing and frame loss, see Frame Analysis. For response latency issues, determine the response start and end points, pinpoint the area in question, and understand the specific operations involved.


As shown in the figure, the subsequent animation has reached the maximum frame rate, indicating that the unresponsive period occurs within the area in the figure.


According to the preceding analysis, excessive computations may be generated on the web side. You need to use DevTools for further analysis.
Click here to debug frontend pages by using DevTools.
The following figure shows the captured DevTools lane graph. This section analyzes the possible abnormal areas.

This page does not involve network interactions. Therefore, some areas such as the network area are not marked. Examples will be provided later.
When you touch to switch on the HTML5 page, the Web component has been initialized, and the touch event is processed by the Web component. This process mainly occurs in areas ①, ②, ③, and ④ in the following figure.

The following process is executed after a touch:
The response is slow due to the following reasons:
This following describes the component loading exception, network exception, animation exception, and blank area exception.
This matches area ② in the following figure. You can record the time consumed for loading the content.

Exceptions:

The following figure shows the time consumed by the source code.

It can be seen that the source code shows the time consumed by a specific method. The myFun1 method uses recursion, which greatly increases the CPU computing time and causes response latency. The recursive method myFun1 is optimized to the loop method myFun2. The time complexity is reduced from O(2^n) to O(n), which significantly reduces the time consumption in this scenario. According to the test, the actual time consumed by myFun2 is measured in microseconds, which cannot be collected by DevTools. You are advised to use other methods to collect and analyze the function time consumption.
The high ratio of time consumed on a network usually occurs in the response phase. After a request on a network is complete, the JS or task execution thread is blocked. As a result, the overall time consumption increases significantly. For details, see area ② in the following figure.

If there is a large difference between the trace start point and end point of the response time tested in area ④, an exception may occur in the animation area. Typically, the background color of the page in the animation is transparent, and the animation curve is slow and then fast. As a result, when the animation starts, the transparent background does not change visually.

This matches area ⑤ in the following figure.

Exceptions:
If the timer delay function await delayFun(500) exists in the code, remove the redundant latency function for optimization.

The consumed time is significantly reduced and changes to the normal value.
By using the screen recording, trace tool, and DevTools through the preceding procedures, you can effectively locate and solve the touch response latency issues on the web page.