Improving AJAX Performance:-

Performance of the application will decrease when you send large amount of script code to client. As a developer you might use couple of tool to analysis the performance like YSlow for Firebug and developer tools for Internet Explorer. In addition to analysis, here is the couple of tips that helps to improve the application performance

1. Content Delivery Network

In application you might have added the jQuery into your server code. Instead of sending script from server (i.e “\Scripts\” folder), you can directly refer the scripts from content delivery network (CDN). CDN has edge-cached servers located around the world, so there is good chance that client will experience faster download. If other site also refers CDN, then there is possibility that files are already cached locally.

    
     <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.2.min.js"
type="text/javascript"></script>
    
    

2. Script optimization

Always it is good practice to place the scripts tags at bottom of the page. There is problem in place the script at the <head> tag of the page, because when browser comes to the script tag section, it blocks other downloads until it retrieves the entire scripts. This makes user page loading slower.

3. Bundling and Minification

Bundling and Minification is the one of the features which optimizes the performance of web page by minifying (reduce file size) and bundling (combine multiple files into single download). This performance optimization will come under “System.Web.Optimization” namespace.

In the MVC application you can configure this feature by using “BundleConfig.cs”, where multiple scripts files are packaged into single

    
    public static void RegisterBundles(BundleCollection bundles)
        {
            bundles.Add(newScriptBundle("~/bundles/jquery").Include(
            "~/Scripts/jquery-{version}.js"));

            bundles.Add(newScriptBundle("~/bundles/jqueryui").Include(
            "~/Scripts/jquery-ui-{version}.js"));

            bundles.Add(newScriptBundle("~/bundles/jqueryval").Include(
            "~/Scripts/jquery.unobtrusive*",
            "~/Scripts/jquery.validate*"));