用户控件在asp.net和Performance中

asp.net中的UserControls是否会降低性能. MasterPage有自己的生命周期 Page有自己的生命周期和 UserControls有自己的生命周期. UserControls有助于划分工作负载并且易于维护,但UserControls会降低asp.net应用程序的等级性能吗? 我从未见过它们会降低性能,除

asp.net中的UserControls是否会降低性能.

MasterPage有自己的生命周期
Page有自己的生命周期和
UserControls有自己的生命周期.

UserControls有助于划分工作负载并且易于维护,但UserControls会降低asp.net应用程序的等级性能吗?

解决方法

我从未见过它们会降低性能,除非你做了一些愚蠢的事情,比如让每个用户控件负责它自己的数据库查找,然后将它们绑在Repeater或类似的东西中.如果你使用常识,它们不应该明显降低性能.

但是,如果您正在讨论优化到处理器周期,我猜他们不会因为一切都被编译成MSIL,然后编译到机器代码,所以我猜测编译器可以将其排序并将其处理用户控件与您直接在页面上拥有所有组成控件没有什么不同.
编辑 – 添加

This article争论他们如何才能真正提高绩效.有趣.

In addition to their reusability and
flexibility,Web user controls can
take advantage of the ASP.NET caching
engine to implement what is referred
to as “fragment caching.” Essentially,
fragment caching allows a Web
developer to control the HTML caching
of individual controls on a page,
including setting the duration and
caching various versions of the
control based on query string,control
properties,browser type,and even
custom strings. The ability to cache
only portions of pages is powerful
since a portion of a page will often
access relatively static data stored
in a relational database or accessed
through an XML Web service,while
other portions of the same page
manipulate dynamic data. For these
static portions,creating a Web user
control and setting caching options
greatly reduces the number of database
round trips,thereby increasing
performance. In most instances,using
ASP.NET caching judiciously is the
single biggest performance improvement
that can be made.

好问题.我再一次学到了新东西.谢谢.

作者: dawei

【声明】:永州站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。

为您推荐

联系我们

联系我们

0577-28828765

在线咨询: QQ交谈

邮箱: xwei067@foxmail.com

工作时间:周一至周五,9:00-17:30,节假日休息

返回顶部