I dont think using statements slows down the loading speed.
Infact, you can take a look the usefulness of "USING" statement here..
As per project references is concerned, it depends on the type of project you have referenced. whether its a .NET application or a COM component.
Regards TurbulentGeek "
Mark as answer if it helped you..."
Unnecessary using statements and project references definitely decrease the performance,
It check the reference every time when the page loaded.so it is necessary to remove the unwanted references and using statement in the page....
You have to remove the unnecessary references for performance
J.Arun Prakash http://royalarun.blogspot.com/ Marked as answer if it is useful
- Proposed as answer by Royal Arun Prakash Saturday, July 16, 2011 12:51 PM
I agree with project references but not that using statement decrease performance. Using statements are only for us and the compiler and do not impact runtime performance. We can remove all using statements and write code like this instead:
System.String str = "hello world";
System.Collections.Generic.List<string> lst = new System.Collections.Generic.List<string>();
You are talking about pages I guess you refer to ASP.NET? Pages get compiled and cached and not over and over again on every page load.
It is good practice to remove using statements that are not needed, reduces clutter and makes source more readable.
Chapter 5 — Improving Managed Code Performance:No where in above MSDN link it specifies that Using will reduce the performance... (this is different from IDisposable using which is used to increase performance)But as a part of practice, you can simply right click on the project, and click on "Remove and Sort Usings". This action will remove all unused Using references.
using statements do not impact performance at all. In a compiled assembly, it is impossible to tell whether using statements were used.
References will slow down a program in the sense that the more of them you have, the slower the program will load. However, I have never had an issue with a program being slow because of references. You do not have to worry about unused references slowing your program down. Visual Studio handily eliminates any unused references.
Having lots of using statements might slow down the Visual Studio IDE while editing your code, as the intellisense window has to filter through many more types. The same applies to build times, the compiler has to check more namespaces in order to resolve a type, making your build slower than needed.
As Visual Studio and Resharper do background compilation, it is important for the IDE performance to reduce the number of using statements to improve the responsiveness of the IDE. Though most of this processing happens on a background thread, so if you have a multicore machine (and who hasn't nowadays), the difference should not be that great.
Once the compiler has compiled your code, the number of project references and the number of using statement don't matter anymore. What does matter are the actual used assemblies in your code. The compiler is smart enough not to add a load request to assemblies that were added to the project, but were never used in the code. Though the more assemblies you have in the GAC or in your applications folder, the longer type resolving will take. Once resolved, the difference is again negligibleas the result will be cache for the lifetime of your application.
Remember that you can speed up your application by creating native images of your assemblies using ngen.