windows 如何解决 IE 中的渲染性能问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/212254/
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-09-15 11:29:06  来源:igfitidea点击:

How can I troubleshoot Rendering Performance issues in IE

htmlwindowsperformanceinternet-explorerrendering

提问by Rob

Our web application renders fast in some IE browsers, slow in others... It seems to be an HTML rendering problem... The first 10% of the page displays immediately, the last 90% takes up to 10 seconds, and this is static content. I've run with firefox/yslow, renders very quickly. Seems to be isolated to some users/configurations of ie. Quirks mode does not seem to make a difference.

我们的 web 应用程序在某些 IE 浏览器中渲染速度快,在其他浏览器中速度较慢……这似乎是 HTML 渲染问题……页面的前 10% 立即显示,最后 90% 需要长达 10 秒,这是静态内容。我用 firefox/yslow 运行,渲染速度非常快。似乎与 ie 的某些用户/配置隔离。怪癖模式似乎没有什么区别。

Is there a tool or application that I can use to help me discover a rendering bottleneck? Am I doing something egregious in my code? Could it be a javascript issue? Any help or suggestions will be much appreciated. thanks.

是否有工具或应用程序可以帮助我发现渲染瓶颈?我在我的代码中做了什么令人震惊的事情吗?会不会是 javascript 的问题?任何帮助或建议将不胜感激。谢谢。

采纳答案by mspmsp

Use Fiddler to look at the times to load images, css, js files, etc. In other words, is caching a problem? Javascript can definitely cause issues in different browser versions. There's lots of optimizations you find in some versions that aren't in others. Also, make sure your html is well-formed xhtml if possible. How the page is arranged can also affect life. If your document tree is deep, it may need to wait to render large sections until it reads all the child nodes. Another thing to note, certain toolbars and plugins do look ahead loading and can slow down life. An HTTP Proxy can help you watch what's going on network-wise at least.

用Fiddler查看加载图片、css、js文件等的时间,也就是说缓存有问题吗?Javascript 肯定会在不同的浏览器版本中引起问题。您可以在某些版本中找到许多其他版本中没有的优化。另外,如果可能,请确保您的 html 是格式良好的 xhtml。页面的排列方式也会影响生活。如果您的文档树很深,则可能需要等待渲染大部分,直到它读取所有子节点。另一件需要注意的事情是,某些工具栏和插件确实会提前加载并且会减慢生活速度。HTTP 代理至少可以帮助您观察网络方面的情况。

Not sure if anything of those ideas might help your exact problem, but they can help life overall.

不确定这些想法中的任何一个是否可以帮助您解决确切的问题,但它们可以帮助您的整体生活。

回答by Ray Jezek

If it runs fast in FF or Chrome then it's a javascript issue for sure. IE7 is VERY slow in processing large amounts of script and complicated HTML. We had a sharepoint page that took 10 seconds to render in IE and sub 1 second in FF and Chrome. We benchmarked the page by adding a timer to the server-side processing and sending the output to the client via a Response.Write(). By doing this we could determine the server time to process the page and the client time to render the page (since you would see the timer results on the screen and then wait 10 seconds for the rest to render). The bottleneck was 100% IE on the client. This also explained why the speed was variable on different peoples machines, because depending on how fast the client machine was the page would render at some speed between 8-15 seconds.

如果它在 FF 或 Chrome 中运行得很快,那么它肯定是 javascript 问题。IE7 在处理大量脚本和复杂的 HTML 时非常慢。我们有一个共享点页面,在 IE 中渲染需要 10 秒,在 FF 和 Chrome 中需要 1 秒。我们通过向服务器端处理添加计时器并通过 Response.Write() 将输出发送到客户端来对页面进行基准测试。通过这样做,我们可以确定服务器处理页面的时间和客户端呈现页面的时间(因为您会在屏幕上看到计时器结果,然后等待 10 秒以呈现其余部分)。瓶颈是客户端上的 100% IE。这也解释了为什么不同人的机器上的速度是可变的,因为根据客户端机器的速度,页面将以 8-15 秒之间的某种速度呈现。

We even had MS look at the issue and they confirmed that IE has a "rich rendering" engine which is slower.... IE8 runs much faster but that is no help to anyone today.

我们甚至让 MS 研究了这个问题,他们确认 IE 有一个更慢的“丰富渲染”引擎...... IE8 运行得更快,但这对今天的任何人都没有帮助。

回答by ajh1138

Are you using any behaviors in your CSS? I've seen behaviors bring an app to its knees if too many are used and/or if they affect too many elements. Check for any .htc files lurking around.

你在你的 CSS 中使用了任何行为吗?我已经看到如果使用太多和/或如果它们影响太多元素,行为会使应用程序屈服。检查是否有任何潜伏的 .htc 文件。

Of course behaviors only pertain to IE and they use JavaScript, so I'm sure different IE versions handle them more competently than others.

当然,行为仅与 IE 相关并且它们使用 JavaScript,所以我确信不同的 IE 版本比其他版本更能胜任地处理它们。

回答by Martin Wittemann

There is a special tool for such scenarios called dynaTrace which is available for free at this website: http://ajax.dynatrace.com/pages/This tool could really help you out because its tracking almost everything and its specially build for IEs.

对于此类场景,有一种称为 dynaTrace 的特殊工具,可在此网站上免费获得: http://ajax.dynatrace.com/pages/该工具可以真正帮助您,因为它几乎可以跟踪所有内容并且专为 IE 构建。

回答by Prashanth Everlasto

回答by Byran Zaugg

I use HttpWatchfor troubleshooting linked assets (images, script, css), network or HTTP related problems in IE. There's a free & paid version. Free is fine but you lose out on some nice features.

我使用HttpWatch对 IE 中的链接资产(图像、脚本、css)、网络或 HTTP 相关问题进行故障排除。有免费和付费版本。免费很好,但你会失去一些不错的功能。

回答by Remy Sharp

Steve Souders gives an excellent presentation on 14 (simple) steps to improve the performance of your web pages:

Steve Souders 对提高网页性能的 14 个(简单)步骤进行了出色的演示:

http://developer.yahoo.net/blogs/theater/archives/2007/08/steve_souders_high_performance.html

http://developer.yahoo.net/blogs/theater/archives/2007/08/steve_souders_high_performance.html

If it's hanging in the middle of the page, the first thing I would personally look to do is ensure or move all my JavaScript is at the bottom of the page.

如果它挂在页面中间,我个人首先要做的是确保或移动我的所有 JavaScript 都在页面底部。

IE is great at being a bad performer, particularly with JavaScript, so if you move it to the bottom, IE can render the page, thenget on with processing the JavaScript.

IE 的性能很差,尤其是 JavaScript,所以如果你把它移到底部,IE 可以呈现页面,然后继续处理 JavaScript。