Showing posts with label Convert AJAX Data into HTML. Show all posts
Showing posts with label Convert AJAX Data into HTML. Show all posts

Sep 25, 2009

DOM Performance Tips and Tricks

As Web pages and applications become richer, more data driven, and more dynamic, the need to improve performance becomes more important. One key area where performance gains can often be achieved is when accessing and manipulating the Document Object Model (DOM). While the DOM can be a very powerful tool, it can be a potential performance pitfall when not used correctly. This article addresses some common methods to ensure high performance use of the DOM. Engineering your code with performance in mind from the beginning is generally easier than reengineering poorly performing sites. However, many of the tips and tricks in this article can be implemented after the fact as point fixes.

This topic contains the following sections:

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.
DOM Performance Costs
Figure 1: DOM Performance Costs

Source : http://msdn.microsoft.com/en-us/library/ee358802%28VS.85%29.aspx

DOM Performance Tips and Tricks

As Web pages and applications become richer, more data driven, and more dynamic, the need to improve performance becomes more important. One key area where performance gains can often be achieved is when accessing and manipulating the Document Object Model (DOM). While the DOM can be a very powerful tool, it can be a potential performance pitfall when not used correctly. This article addresses some common methods to ensure high performance use of the DOM. Engineering your code with performance in mind from the beginning is generally easier than reengineering poorly performing sites. However, many of the tips and tricks in this article can be implemented after the fact as point fixes.

This topic contains the following sections:

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.
DOM Performance Costs
Figure 1: DOM Performance Costs

Source : http://msdn.microsoft.com/en-us/library/ee358802%28VS.85%29.aspx

Sep 23, 2009

Convert AJAX/JSON data into HTML

JavaScript Templating is the best way to turn AJAX/JSON data into HTML. Jemplate is the best way to do JavaScript Templating.
Jemplate beats other JavaScript Templating frameworks hands down for the following reasons:
  • Jemplate is a complete port of the popular Template Toolkit framework. This means it is very full featured indeed.
  • Templates are precompiled (one time, on the server) as JavaScript functions. There is no JavaScript runtime penalty of compiling templates.
  • Templates are not stored in your HTML. No silly tricks, like putting template code in hidden textareas.
  • A browser downloads your templates once and caches them. Just like any other JavaScript code.
This site is generated entirely by Jemplate. View Source to see for yourself.

Source : http://jemplate.net/

Jemplate Links

Convert AJAX/JSON data into HTML

JavaScript Templating is the best way to turn AJAX/JSON data into HTML. Jemplate is the best way to do JavaScript Templating.
Jemplate beats other JavaScript Templating frameworks hands down for the following reasons:
  • Jemplate is a complete port of the popular Template Toolkit framework. This means it is very full featured indeed.
  • Templates are precompiled (one time, on the server) as JavaScript functions. There is no JavaScript runtime penalty of compiling templates.
  • Templates are not stored in your HTML. No silly tricks, like putting template code in hidden textareas.
  • A browser downloads your templates once and caches them. Just like any other JavaScript code.
This site is generated entirely by Jemplate. View Source to see for yourself.

Source : http://jemplate.net/

Jemplate Links

Text Widget

Copyright © Vinay's Blog | Powered by Blogger

Design by | Blogger Theme by