Tuesday, May 15, 2007

Trim your page size

Trim your page size


Not something we think about much - but becomes important when clients are connecting over a slow network. Reducing the page size can reduce the waiting time for the client for the page to get rendered. Ways to reduce the page size:


a. Remove extra spaces, new lines, tabs - This is something that goes against good coding pratices actually, but will help reducing the page size


b. Use script includes for static javascripts so that they can be cached for subsequent requests.

c. Limit the use of graphics, consider using compressed graphics

d. Use CSS for styling to avoid sending same formatting directives to the client repeatedly

e. Avoid long control names! (Ever given it a thought? :))

f. Use ASP .NET's server side comments in the page. The syntax is:


·         The key difference is that with client-side comments it is the browser which is ignoring the content within them.  Code/controls within client-side comments will still be executed on the server and sent down to the browser.  As such, if there is a server error caused within them it will block running the page.

·         With server-side comments, the ASP.NET compiler ignores everything within these blocks at parse/compile time, and removes the content completely when assembling the page.

·         Consequently, any errors caused by mal-formed controls or issues with inline code or data-binding expressions within them will be ignored.  The page is also just as fast with controls/code within server-side comments as if there were no controls/code on the page at all (there is no runtime performance overhead to them).




Thanks & Regards,

Arun Manglick

SMTS || Microsoft Technology Practice || Bridgestone - Tyre Link || Persistent Systems || 3023-6258


DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.

No comments:

Post a Comment