ASP.NET Performance Tip: Remove Unnecessary Library References

Over the last few days, I’ve been scouring the web for techniques and strategies to optimize ASP.NET code so that it runs faster and more efficient, resulting in quicker load times. A lot of what I found was pretty standard advice, disable viewstate, use the StringBuilder for concatenation, disable tracing and use AJAX. One piece of advice that I didn’t find when searching was to be selective about the libraries that you reference.

By default, ASP.NET will add the following references to your page:

using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

In a library that I was using, I was able to pair those down to these five libraries:

using System;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

After removing the un-necessary libraries, the page load time decreased by nearly half of a second. If you were to do this with all of your libraries and pages, chances are you could see a pretty significant performance increase.

Comments

  1. Thanks for sharing information about ASP.NET Performance Tip: Remove Unnecessary Library References I really impressed and want some more stuffs again for this post.

Speak Your Mind

*