IE hanging with 100% CPU / Got stack trace

你。 提交于 2019-12-06 05:01:25
vladr

Based on the stack trace, it is in the middle of altering the DOM. As commented on your previous post, IE is extremely inefficient when doing both reads and writes on the DOM (when compared to Firefox and Chrome.)

The performance problems can be tackled by reducing and optimize both the reading and the writing of the DOM by:

  1. navigating the DOM using simple DOM properties and methods whenever possible (Document.getElementById, DomElement.parentNode, DomElement.childNodes[], DomElement.nextSibling, etc.) instead of the XPATH (CSS) selector methods (DomElement.querySelector)
    • this is because querySelector behaves O(N) under IE, where N is the size of the entire DOM - that is, you will pay the penalty of traversing the entire DOM even if you call querySelector on a leaf node that has no children!
    • if you trigger one or more querySelector calls for each element in a considerable subset of the DOM, you are essentially paying O(N^2) penalty
    • note that YUI's YAHOO.util.Selector.query, Prototype's element.down, element.up, element.select all use the querySelector call internally
  2. altering the UI behavior, if possible, to skip or defer as much DOM traversal and modification as possible
    • present as little information at a time; force the user to click (e.g. on expand links etc.) in order for you to proceed with additional processing/modifications
  3. switch away from Javascript, to Flash or Java.

Given that you are using YUI you may not have a lot of latitude as far as option 1 goes, and I can imagine that option 3 is almost certainly a non-option for you. Which unfortunately leaves option 2.

Does it hang in all browsers or just IE7?

The only thing that stands out to me is "IEDevToolbar.dll!"

Also... it could be your app doing something it should not.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!