自定义服务器控件和用户控件之间是否存在性能差异?
考虑两个执行基本相同操作的控件。例如,具有分页、排序和数据缓存功能的类似 gridview 的小部件。两者都绑定相同的 10,000 行数据源。一种是自定义服务器控件,一种是用户控件。是否有任何原因会导致性能差异?
只是想知道社区对此有何看法。
Consider two controls that do basically the same things. For instance, a gridview-like-widget with paging, sorting, and data caching. Both bound with the same 10,000 row data source. One is a custom server control and one is a user control. Is there any reason there would be any difference in performance?
Just wondering that the community thinks about this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设两个控件包含相同的代码,则不会有任何性能差异。它们之间的区别只是代码的编译方式(用户控件直接编译到 Web 应用程序的 dll 中,服务器控件编译到它们自己的 dll 中)以及编译时间(由其本身或与 Web 应用程序一起编译)。
一旦编译完成,它们就和其他类一样。
Assuming the 2 controls contained identical code, there would not be any performance difference. The difference between them is simply how the code is compiled (Usercontrols are compiled directly into the web application's dll, and server controls are compiled into their own dlls), and when they are compiled (by themselves or with the web application).
Once compiled, they are classes like any other.