5.5. Script Combining
Script compression allows you to reduce the size of scripts sent to the client, but it doesn't reduce the number of separate scripts an ASP.NET AJAX page may be using. Besides the framework scripts MicrosoftAjax.js (the core framework) and MicrosoftAjaxWebForms.js (for partial rendering), there may be additional script references specified in the ScriptManager. ASP.NET AJAX compatible controls and components on the page may each require additional scripts that are embedded in their respective assemblies, adding even further to the number of scripts the page requires. A page can easily require a dozen or more scripts, even if there are no script references declared.
Script references are rendered as <script> elements at the top of the form. Each reference is processed by the browser, which issues a request to the server. Requests involve overhead to process, and involve network latency. If there are a dozen script references, there will be a dozen requests to the server, each with its own overhead and network latency. Script references are typically cached on the client thereafter, but if many of your users are first-time visitors that do not have a saturated cache, that may not be of much help.
It may not seem so bad. If the browser requested all 12 scripts simultaneously, they could load in parallel. However, that is not how the browser does it. Since one script may depend on another, the browser must load them in sequential order. Also, since scripts may ...
Get Professional ASP.NET 3.5 AJAX now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.