服务器端包含与 ASP.NET 技术之间是否存在性能差异?
我最近受聘更新 ASP.NET 1.0 站点,该站点是在母版页可用之前创建的。因此,这些页面具有服务器端包含 (ssi),如 。我打算使用包含先前在 ssi 中的标记的母版页来更新 *.aspx 页面。我相信这是正确的做法,特别是从可维护性的角度来看。然而,一位同事坚信性能会受到影响,因为据说 ssi 是一种非常“轻量级”的技术(他的话不是我的话)。我找不到太多关于一种技术与另一种技术性能的信息。如果有的话,我相信母版页和 Web 控件的其他优势仍然会更重要。你的想法?
I was recently hired to update an ASP.NET 1.0 site, created before master pages were available. Hence the pages have server side includes (ssi) like <!-- #include file="footer.html" -->
. I was about to update the *.aspx pages with a master page that contained the markup previously in the ssi's. I'm convinced this is the right thing to do, especially from a maintainability perspective. However a co-worker firmly believes performance would suffer as supposedly ssi's are a very 'lightweight' technique (his words not mine). I can't find much information regarding performance of one technique versus the other. And if there is, I believe the other advantages of master pages and web controls would still be more important. Your thoughts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
SSI 会比较慢,因为每次调用都是进程外请求。母版页经过编译且非常快速的进程内操作。
SSI would be slower as every call out is an out-of-process request. Master Pages are compiled and very fast in-process actions.
对于小型静态页面,我不知道,它在性能方面可能非常接近。您可以运行负载测试来获取一些硬数据并找出答案。
然而,使用母版页实际上没有任何缺点,而且就设计和管理而言还有很多优点。
In the case of a small static page, I don't know, it's probably pretty close performance-wise. You could run a load test to get some hard numbers and find out.
However, there's really no disadvantage to using a master page, and there are a whole lot of advantages as far as design and management go.
从技术上讲,SSI 可能更快一点,因为包含内容被拉入页面并编译成单个类。 MasterPages 有点慢,因为它们都被编译成自己的类,并且页面需要加载该类的实例。
出于所有实际目的,性能增益可能几乎可以忽略不计,MasterPage 和 Web 控件的好处可能弥补任何性能损失。
Technically the SSI is probably a little faster, because the includes are pulled into the page and compiled into a single class. The MasterPages are a little slower, because they are each compiled into their own class and the page will need to load an instance of that class.
For all practical purposes, the performance gain is probably almost negligible and the benefits of the MasterPage and Web Controls probably make up for any performance loss.