This topic contains the following sections:
- Understanding the DOM
- Avoid Time-intensive API's
- Use Smart Coding Patterns
- Finding DOM Intensive Code
Understanding the DOM
Basic knowledge of how the DOM works in Internet Explorer is helpful for understanding the origins of some of the performance gains mentioned in this article. The DOM is initially constructed as the web page is parsed. However, it is constantly adjusted and updated as the web page is manipulated by either user, programmatic, or browser interaction. For those unfamiliar with the structure and capabilities of the Internet Explorer DOM, About the W3C Document Object Model is an excellent starting point.
An important aspect of the DOM is described in Figure 1. Simply put, DOM access is much more expensive than most other JavaScript. This is partly due to the immense nature of the DOM and partly due to the fact that DOM access requires the use of an internal interface layer because it is not a native part of the JavaScript language itself. Nevertheless, that is not to say that DOM access should be avoided altogether. Rather, minimizing unnecessary DOM interactions can often yield performance gains.
Figure 1: DOM Performance Costs
Source : http://msdn.microsoft.com/en-us/library/ee358802%28VS.85%29.aspx
0 comments:
Post a Comment