设置为可更新的预编译 Web 应用程序项目的性能优势?

发布于 2024-08-11 00:31:11 字数 178 浏览 5 评论 0原文

如果将 ASP.NET Web 应用程序设置为可更新,那么预编译它是否有任何性能优势?通过设置预编译器可更新标志,它不会预编译 aspx、ascx 等,因此仍然必须在第一页加载时在运行时编译它们。无论如何,ASP.NET Web 应用程序项目中的其他所有内容都已编译,那么在可更新标志设置为 true 的 WAP 上运行预编译器有什么意义呢?

Is there any performance benefit to pre-compiling an asp.net web application if it's set to be updateable? By setting the pre-compiler updateable flag it doesn't pre-compile the aspx, ascx, etc. so those still have to be compiled at run-time on the first page load. Everything else in an ASP.NET Web Application Project is already compiled anyways though, so what is the point of running the pre-compiler on a WAP with the updateable flag set to true?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

随心而道 2024-08-18 00:31:11

唯一的性能优势是它为您的 ASPX 和 ASCX 文件预编译关联的代码隐藏文件。

The only performance benefit is that it pre-compiles the associated code-behind files for your ASPX and ASCX files.

甜宝宝 2024-08-18 00:31:11

ASP.NET 旨在通过将服务器端代码编译为 Web 服务器上的一个或多个 DLL 文件来获得优于其他基于脚本的技术(包括经典 ASP)的性能优势。 [18]第一次请求页面时,此编译会自动发生(这意味着开发人员无需为页面执行单独的编译步骤)。此功能提供了脚本语言提供的开发便利性以及编译的二进制文件的性能优势。但是,当首次从 Web 服务器请求新编辑的页面时,编译可能会给 Web 用户带来明显但短暂的延迟,但除非进一步更新所请求的页面,否则不会再次出现延迟。

ASPX 和其他资源文件放置在 Internet 信息服务服务器(或其他兼容的 ASP.NET 服务器;请参阅下面的其他实现)上的虚拟主机中。客户端第一次请求页面时,.NET 框架会解析文件并将其编译为 .NET 程序集并发送响应;后续请求由 DLL 文件提供。默认情况下,ASP.NET 将在第一次请求时以 1000 个文件为批次编译整个站点。如果编译延迟导致问题,则可以调整批处理大小或编译策略。

开发人员还可以选择在部署之前预编译代码,从而无需在生产环境中进行即时编译。这也消除了在 Web 服务器上保留源代码的需要。

(直接摘自维基百科页面)对编译代码相对于脚本代码(例如 php 或类 ASP)的好处进行了很好的解释。

ASP.NET aims for performance benefits over other script-based technologies (including Classic ASP) by compiling the server-side code to one or more DLL files on the web server.[18] This compilation happens automatically the first time a page is requested (which means the developer need not perform a separate compilation step for pages). This feature provides the ease of development offered by scripting languages with the performance benefits of a compiled binary. However, the compilation might cause a noticeable but short delay to the web user when the newly-edited page is first requested from the web server, but won't again unless the page requested is updated further.

The ASPX and other resource files are placed in a virtual host on an Internet Information Services server (or other compatible ASP.NET servers; see Other Implementations, below). The first time a client requests a page, the .NET framework parses and compiles the file(s) into a .NET assembly and sends the response; subsequent requests are served from the DLL files. By default ASP.NET will compile the entire site in batches of 1000 files upon first request. If the compilation delay is causing problems, the batch size or the compilation strategy may be tweaked.

Developers can also choose to pre-compile their code before deployment, eliminating the need for just-in-time compilation in a production environment. This also eliminates the need of having the source code on the web server.

(Taken directly from the wikipedia page) A great explanation of the benefits of compiling your code over scripted code such as php or class ASP.

时光礼记 2024-08-18 00:31:11

据我所知,在这种特定情况下,当由于问题中列出的原因将 WAP 设置为可更新时,预编译 WAP 不会带来性能优势。

From what I can tell in this specific case there isn't a performance benefit to pre-compiling a WAP when it's set to updateable for the reasons listed in the question.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文