技巧之一:提高使用request集合的效率
访问一个asp集合来提取一个值是费时的、占用计算资源的过程。因为这个操作包含了一系列对相关集合的搜索,这比访问一个局部变量要慢得多。因此,如果打算在页面中多次使用request集合中的一个值,应该考虑将其存贮为一个局部变量。
例如将代码写成下面的形式以加快脚本引擎处理速度:
strtitle=request.form("title")
strfirstname=request.form("firstname")
strlastname=request.form("lastname")
if len(strtitle) then strtitle=strtitle & " "
if strfirstname="" then strfullname=strtitle & " " & strlastname
elseif len(strfirstname)=1 then
strfullname=strtitle & strfirstname & ". " & strlastname
else
strfullname=strtitle & strfirstname & " " & strlastname
end if
…… code to create first part of the page
if response.isclientconnected then
response.flush
else
response.end
end if
…… code to create next part of page
while not rsgc.eof
response.write "工程名称:" & rsgc("gcmc") & "(工程代码:" & rsgc("gccode")
& ")
"
rsgc.movenext
wend
set gcmc=rsgc("gcmc")
set gccode=rsgc("gccode")
while not rsgc.eof response.write "工程名称:" & gcmc & "(工程代码:" & gccode & ")
" rsgc.movenext
wend
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器