0

I know some of you guys would consider it an unrelated question but, It's an important question for an MVC developer when you making it certain to make your application efficient and speedy.

As you know that we can import a namespace into a view using 'using' clause.

My question is that should I import namespaces in view without getting worried about performance and load time of the view?

Is it really affects to import plenty of namespaces? If yes? How? And how can we get rid of this kind of performance issues?

Thanks

Rashid Ali
  • 587
  • 3
  • 13
  • What do you mean by "plenty of namespaces"? You import just the ones you need inside that view. If namespaces appear in several views, you'd be better of importing that namespace trough `web.config`. If you find yourself needing _plenty_ namespaces inside a view, you're probably doing something wrong. All and all, I don't think this is something to worry about. – Andrei V Jun 12 '15 at 07:48
  • Right click one of your `using` statements, click `Organize Usings`, then `Remove and Sort` if you want to remove unused namespaces –  Jun 12 '15 at 07:49
  • possible duplicate of [How is performance affected by an unused using statement](http://stackoverflow.com/questions/1162766/how-is-performance-affected-by-an-unused-using-statement) – ramiramilu Jun 12 '15 at 07:50
  • @AndreiV: I don't have plenty of namespaces to import in a view infact but, I was just wondering when I import 4th one :) – Rashid Ali Jun 12 '15 at 07:55
  • It doesn't affect the performance of the _compiled_ result. – Andrei V Jun 12 '15 at 07:57

1 Answers1

0

Actually, i don't think that it can lower the performances of the website. It may make the compilation a bit longer (A little bit), but after that, your website is compiled.

And, i think you'll loose much more "performances" by all the treatment you'll have in your controllers ;)

Guillaume Munsch
  • 1,233
  • 17
  • 37