views:

49

answers:

4

Would usage of more number of application variables affect the performance of an asp.net website ?

+1  A: 

not in any significant way.

rikh
A: 

As long as they're local variables, not. If static variables, in extreme cases it could (e.g. in case of an ever-growing collection) but in normal use cases it will not have any noticeable effect.

Gergely Orosz
A: 

You mean variables attached to the "Application" object, right?

No, it shouldn't be a problem, provided you realise:

  • They are shared by different threads so there may be concurrency problems
  • They are NOT shared by different worker processes, so you can't guarantee exactly one instance, even if you have only one machine
MarkR
A: 

If you create large objects during run-time it definitely affects performance.

If you create them all during initialization they can affect run time if you access one then another then one and another back and forth which may cause paging (look up the term).

Variables like int, char, double, ... don't affect performance, large arrays of them can.

I recommend you read about how the cache works and how operating system allocate/deallocate memory.

Danny Varod