博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[Debug] Diagnose a Slow Page Using Developer Tools
阅读量:7125 次
发布时间:2019-06-28

本文共 1285 字,大约阅读时间需要 4 分钟。

Your page is showing high CPU usage and spinning up your laptop fan, but nothing is visibly happening. What is it doing, and why is it so slow?

This lesson is a real-world performance diagnosis of this very page, right here on egghead. Two infinite (but hidden) animations were causing CPU usage to spike, and Chrome's Task Manager and Performance tools helped uncover the elements causing the problem. You'll see how to use the profiler to record a snapshot, and learn a trick for discovering animations running in the background.

 

 

There numbers of things you can do to detect a slow page

1. Check the CPU usage

2. Bring up the chrome dev tool, performance monitor, pretty much you can say above 10% CPU usage is high

3. Record the Performance in dev tool to see any 'Layout' event, usually Layout event cause the DOM re-render, so we need to be carefully about this.

  If there is such, check which element it is and try to solve the problem. For example, a hidden svg loading spinner, can cause the problem, we can set it to 'display: none', so it remove from the DOM

4. If there is any animation happens, we can do:

window.onanimationiteration = console.log

It will prints out when animation happens, so we can know that whether there is any unnecessary animation in the background.

转载地址:http://qdeel.baihongyu.com/

你可能感兴趣的文章
微信JS-SDK使用权限签名算法的服务端实现(.net版本)
查看>>
windows下ruby安装环境配置
查看>>
Wndows 主进程(Rundll32)已停止工作
查看>>
C#的百度地图开发(一)发起HTTP请求
查看>>
用12306购票所想到的(改善的地方)
查看>>
Java设计模式(1)工厂模式(Factory模式)
查看>>
硬盘惊魂记
查看>>
mysql函数
查看>>
php xls 导出乱码解决方案
查看>>
[Android Traffic] 让android应用在传输网络数据的时候更省电
查看>>
Eclipse中Maven插件配置
查看>>
对于GetBuffer() 与 ReleaseBuffer() 的一些分析
查看>>
FluentData,一个轻量级开源的.NET ORM数据持久化框架
查看>>
怎样用纯HTML和CSS更改默认的上传文件按钮样式
查看>>
使用C/C++编译预处理时须要注意的问题
查看>>
实战:上亿数据如何秒查(转)
查看>>
从零开始学习jQuery (十) jQueryUI常用功能实战
查看>>
使用php扩展mcrypt实现AES加密
查看>>
BZOJ3941 : [Usaco2015 Feb]Fencing the Herd
查看>>
远程登录
查看>>