开发者

Application variables and performance?

Would usage of more number of application variables affect the performance of an asp.net webs开发者_C百科ite ?


not in any significant way.


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.


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.


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜