Performance Tuning - Top to Bottom - Visual Studio .NET


HTML clipboard

Instead of using Table Layout, go for Div based Layout

Table layout is generally used to display the tabular kind of Information. But web developers mostly use the table based web layout for their easier implementation. Page size will get increased because of this table based layout. If we replace the table layout with Div based layout, page size will be decreased, because most of the styles will be declared in the CSS files. Rendering will be faster when compared with table based layout; entire page will be visible only when the end tag of the table is rendered.

Put the Javascript & Styles in seperate Js & CSS files

JavaScript and Style sheet files will be fetched from the server only once, and at the next time when it's get requested it will be retrieved from the cache. It reduces the transfer and network cost.

Minify Javascript & CSS files

Always minify your javascript and CSS files while deploying it in production, which will reduce the network and transfer cost.

Disable Debug Mode

Always disable the debug mode while moving the code to production, which improves the performance of the site.

Appropriate usage of controls

Use the web controls according to their usage. For eg: don't use gridview everywhere to display the tabular information, because it's a heavy weight controls. So first know the exact usage of control and then implement it.

Code optimization

Optimize your code everywhere, by avoiding unnecessary loops, selecting the appropriate data structures, proper string handling. Don't use try catch block everywhere in the code, it's again a big headache for the compiler; instead check for null objects everywhere.

Compression Techniques

Use HTTP compression methods, if your page size is more, it will reduce the file size while transferring from server to the client.

Image Striping

If your web page deals with more images, try to put the entire image in a single file and load it once in a page. Just position the appropriate image for various images. Try to use only the png file format, since it will be transferred as stream of bytes from server to the client, which will be transferred quickly.

Client side Scripting

Try to use client side scripting wherever applicable to avoid the unnecessary page post back.

Session State

Disable the session state if you are not using it. 

View State

Disable the view state if you are not using it. Don't put huge values in view state, it will affect the page performance, since it will increase the page size.

String Handling

Use the StringBuilder for manipulating larger strings, during concatenation of two strings.
 


Similar Articles