javascript CPU 使用率高的网页——如何分析

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19876699/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 17:07:29  来源:igfitidea点击:

Web page with high CPU usage -- how to profile

javascriptprofilinggoogle-chrome-devtools

提问by mrzasa

I have a webpage to optimize. When I enter it, the CPU usage increases drastically. I tried to use Chrome Dev Tools, but profiler 92% of the time is in the (program)line. What could I do to find the culprit of this behavior?

我有一个网页要优化。当我输入它时,CPU使用率急剧增加。我尝试使用 Chrome 开发工具,但分析器 92% 的时间都(program)在行中。我该怎么做才能找到这种行为的罪魁祸首?

回答by George

I've had the same issues before. I don't have a lot of experience using Chrome Dev Tools but here are some useful links:

我以前也遇到过同样的问题。我没有很多使用 Chrome Dev Tools 的经验,但这里有一些有用的链接:

回答by loislo

Please use Timeline panel. It will show you what the page does. It shows information about javascript calls, gc, layout, paint etc.

请使用时间轴面板。它将向您展示该页面的作用。它显示有关 javascript 调用、gc、布局、绘制等的信息。

https://developers.google.com/chrome-developer-tools/docs/timeline

https://developers.google.com/chrome-developer-tools/docs/timeline