最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
asp性能测试报告(转)(八)
时间:2022-07-02 23:58:17 编辑:袖梨 来源:一聚教程网
使用过程和函数对于代码的组织和维护有着很大的好处,特别是页面中部分代码需要多次使用的时候。不过此时为了完成相同的处理任务要多出一次函数(或过程)的调用,这是它的缺点。从理论上看,函数块内的变量具有更好的效率。下面我们来看看这两个问题的测试结果。
8.1 将Response.Write语句移入子过程
在这个测试中,我们只把Response.Write语句放到了子过程里面。
...
CALL writeTable()
SUB writeTable()
Response.Write("< html >" & _
"< head >" & _
...
"< tr >< td >< b >EMail:< /b >< /td >< td >" & EMail & "< /td >< /tr >" & _
"< tr >< td >< b >Birth Date:< /b >< /td >< td >" & BirthDate & "< /td >< /tr >" & _
"< /table >" & _
"< /body >" & _
"< /html >")
END SUB
/app2/function1.asp片断
基 准 = 5.57 毫秒/页
响应时间 = 6.02 毫秒/页
差 额 = +0.45 毫秒 (增加8.1%)
和预期的一样,子过程调用增加了额外的页面处理负担。
8.2 将所有脚本移入子过程
在这个测试中,Response.Write和所有的变量声明都移到了子过程里面。
< % OPTION EXPLICIT
CALL writeTable()
SUB writeTable()
Dim FirstName
...
Dim BirthDate
FirstName = "John"
...
BirthDate = "1/1/1950"
Response.Write("< html >" & _
"< head >" & _
" < title >Response Test< /title >" & _
"< /head >" & _
"< body >" & _
"< h1 >Response Test< /h1 >" & _
"< table >" & _
8.1 将Response.Write语句移入子过程
在这个测试中,我们只把Response.Write语句放到了子过程里面。
...
CALL writeTable()
SUB writeTable()
Response.Write("< html >" & _
"< head >" & _
...
"< tr >< td >< b >EMail:< /b >< /td >< td >" & EMail & "< /td >< /tr >" & _
"< tr >< td >< b >Birth Date:< /b >< /td >< td >" & BirthDate & "< /td >< /tr >" & _
"< /table >" & _
"< /body >" & _
"< /html >")
END SUB
/app2/function1.asp片断
基 准 = 5.57 毫秒/页
响应时间 = 6.02 毫秒/页
差 额 = +0.45 毫秒 (增加8.1%)
和预期的一样,子过程调用增加了额外的页面处理负担。
8.2 将所有脚本移入子过程
在这个测试中,Response.Write和所有的变量声明都移到了子过程里面。
< % OPTION EXPLICIT
CALL writeTable()
SUB writeTable()
Dim FirstName
...
Dim BirthDate
FirstName = "John"
...
BirthDate = "1/1/1950"
Response.Write("< html >" & _
"< head >" & _
" < title >Response Test< /title >" & _
"< /head >" & _
"< body >" & _
"< h1 >Response Test< /h1 >" & _
"< table >" & _
相关文章
- 埃隆·马斯克背书推动比特币逼近11万美元 07-08
- Dreamweaver怎么裁剪图片? dw编辑图片的技巧 07-08
- CS2裂变天地s1赛程表一览 07-08
- 斗罗大陆猎魂世界武魂融合技如何发动 07-08
- 必须拿住:迈克尔·赛勒发布比特币牛市图表 07-08
- 大侠立志传爱猫失踪任务完成指南 07-08