做了很多包括的(在"&情况QUOT;)在ASP经典的伤害服务器的性能? [英] Does many include's (in "case") in ASP classic hurt the performance of the server?

查看:107
本文介绍了做了很多包括的(在"&情况QUOT;)在ASP经典的伤害服务器的性能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想建立与ASP经典本页面:

I want to build this page with ASP classic:

<%
Dim depart

depart = 1556


Select Case depart
    Case 1
    %>
    <!--#include virtual="/check/noam/newDesign/test1.asp"-->
    <%
    Case 2
    %>
    <!--#include virtual="/check/noam/newDesign/test2.asp"-->
    <%
    Case 3
    %>
    <!--#include virtual="/check/noam/newDesign/test3.asp"-->
    <%
    Case 4
    %>
    <!--#include virtual="/check/noam/newDesign/test4.asp"-->
    <%
    Case 5
    %>
    <!--#include virtual="/check/noam/newDesign/test5.asp"-->
    <%
    Case 6
    %>
    <!--#include virtual="/check/noam/newDesign/test6.asp"-->
    <%
    Case 7
    %>
    <!--#include virtual="/check/noam/newDesign/test7.asp"-->
    <%
    Case 8
    %>
    <!--#include virtual="/check/noam/newDesign/test8.asp"-->
    <%
End If
%>

和我想知道,如果在后台服务器需要输入到每一个包括或他将只输入到包括在正确的情况下?
我需要知道,因为我想知道如果服务器将获得与这一个糟糕的表现。

And I like to know if the server in the background need to enter to every include or he will enter only to the include in the right case? I need to know that because I like to know if the server will get bad performance with this one.

推荐答案

这要看里面是什么了,但是包括我不希望这样的结构对性能的影响观察到,除非你要么有case语句100S或者有每秒请求的页面100S。

It really depends on what is inside the includes but I wouldn't expect such a structure to have any observable impact on performance unless you either have 100s of case statements or have 100s of requests per second for the page.

这是事实,所有的包括将组成到脚本但是第一个被执行之前code也应该记住,最终剧本的创作和分析P- code版本缓存通过ASP。

It is true that all the includes will be composed into the script first before code is executed however it should also be remember that the composed and parsed "p-code" version of the final script is cached by ASP.

如果在包含有primarly只是静态的HTML内容,那么这种做法实际上是相当有效的。在另一方面,更多的内嵌全局标识符(标识符不包含在功能)注册在脚本下的这些标识符需要更多的时间(但有仍然需要一个的很多的他们做出noticable差)。

If the includes are primarly just static HTML content then this approach is actually quite efficient. On the other hand the more inline global identifiers (identifiers not enclosed in Sub, Function or Class) the more time needed to register these identifiers in the Script context (however there would still need to a lot of them to make a noticable difference).

一个潜在的替代方法是使用使用Server.Execute ,而不是包括。在这种情况下执行的ASP有自己独立的脚本上下文,因此不能共享调用者函数和变量(这可能会或可能不会是一件好事。)也是其很可能是使用Server.Execute 实际上将变成慢。

A potential alternative is to use Server.Execute instead of an include. In this case the ASP executed has its own independant script context so it can't share the callers functions and variables (this may or may not be a good thing.) Also its quite possible that Server.Execute will actually turn out slower.

这篇关于做了很多包括的(在&QUOT;&情况QUOT;)在ASP经典的伤害服务器的性能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆