如果页面渲染慢,可以看network中waterfall中的耗时分布
Here's more information about each of the phases you may see in the Timing tab:
* **Queueing**. The browser queues requests when:
* There are higher priority requests.
* There are already six TCP connections open for this origin, which is the limit. Applies to HTTP/1.0 and HTTP/1.1 only.
* The browser is briefly allocating space in the disk cache
* **Stalled**. The request could be stalled for any of the reasons described in **Queueing**.
* **DNS Lookup**. The browser is resolving the request's IP address.
* **Initial connection**. The browser is establishing a connection, including TCP handshakes/retries and negotiating an SSL.
* **Proxy negotiation**. The browser is negotiating the request with a [proxy server](https://en.wikipedia.org/wiki/Proxy_server).
* **Request sent**. The request is being sent.
* **ServiceWorker Preparation**. The browser is starting up the service worker.
* **Request to ServiceWorker**. The request is being sent to the service worker.
* **Waiting (TTFB)**. The browser is waiting for the first byte of a response. TTFB stands for Time To First Byte. This timing includes 1 round trip of latency and the time the server took to prepare the response.
* **Content Download**. The browser is receiving the response.
* **Receiving Push**. The browser is receiving data for this response via HTTP/2 Server Push.
* **Reading Push**. The browser is reading the local data previously received.
如果stalled过长,说明获取连接耗时长,如果用的是http/1.1可以升级到http2,合并请求,尽量减少请求数。
如果是TTFB过长,说明服务器处理慢。
如果Content Download过长,要么请求返回的内容很大,要么就是网速很慢。
响应内容是文本的请求,可以开启Nginx的gzip压缩功能。
打开Performance Monitor可以实时监控网页的cpu,内存,页面渲染情况。内存是否会回收?
Record Performance可以查看Main线程占用CPU做了什么事。
Memory可以看对象内存使用情况。