在ASP.NET应用程序中使用应用程序变量

时间:2022-09-15 18:24:18

In my site I have a static table that stores information. I wonder if I should store all this information in an Application so there would be less database calls. Would it be more efficient? Is there other solutions or calling the database constantly for static information is no so bad?

在我的网站中,我有一个存储信息的静态表。我想知道是否应该将所有这些信息存储在一个应用程序中,以便减少数据库调用。会更有效率吗?是否有其他解决方案或不断调用数据库的静态信息是不是很糟糕?

1 个解决方案

#1


0  

The better question is whether it would make a significant difference in performance.

更好的问题是它是否会在性能方面产生重大影响。

What you're doing is called "premature optimization". You are optimizing for performance before you know where your performance problems are located. In fact, you are doing so even before your application is complete.

你正在做的事情被称为“过早优化”。在了解性能问题所在之前,您需要优化性能。事实上,即使在您的申请完成之前,您也是这样做的。

  • First get your application to work.

    首先让您的应用程序工作。

  • Then get your application to work fast enough.

    然后让您的应用程序足够快地运行。

There's no sense in having your application fail in an efficient manner.

让应用程序以有效的方式失败是没有意义的。

#1


0  

The better question is whether it would make a significant difference in performance.

更好的问题是它是否会在性能方面产生重大影响。

What you're doing is called "premature optimization". You are optimizing for performance before you know where your performance problems are located. In fact, you are doing so even before your application is complete.

你正在做的事情被称为“过早优化”。在了解性能问题所在之前,您需要优化性能。事实上,即使在您的申请完成之前,您也是这样做的。

  • First get your application to work.

    首先让您的应用程序工作。

  • Then get your application to work fast enough.

    然后让您的应用程序足够快地运行。

There's no sense in having your application fail in an efficient manner.

让应用程序以有效的方式失败是没有意义的。