asp-页面输出太多会严峻影响web程序的性能__1.docx

上传人:PIYPING 文档编号:11613998 上传时间:2021-08-26 格式:DOCX 页数:4 大小:12.69KB
返回 下载 相关 举报
asp-页面输出太多会严峻影响web程序的性能__1.docx_第1页
第1页 / 共4页
asp-页面输出太多会严峻影响web程序的性能__1.docx_第2页
第2页 / 共4页
asp-页面输出太多会严峻影响web程序的性能__1.docx_第3页
第3页 / 共4页
asp-页面输出太多会严峻影响web程序的性能__1.docx_第4页
第4页 / 共4页
亲,该文档总共4页,全部预览完了,如果喜欢就下载吧!
资源描述

《asp-页面输出太多会严峻影响web程序的性能__1.docx》由会员分享,可在线阅读,更多相关《asp-页面输出太多会严峻影响web程序的性能__1.docx(4页珍藏版)》请在三一文库上搜索。

1、asp:页面输出太多会严峻影响web程序的性能_ 数据量增加的很快,最近发觉它的性能特别差,每次打开都需要十几秒,甚至几十秒,由于我 的程序分页用的是我自己的分页程序: 莫非这个分页程序有问题,但是其他地方用到它没有感觉到慢呀,我没事就琢磨他,到网上查资料,结果没有具体查到说到我的那个分页程序性能差的相关资料,后来我发觉我的程序中的页导航用的是数字导航方法,而且全部的页导航的数字全都输出来了,一共一千多页,能不能使这个地方慢呢?我决定测试一下,所以,我就只让他输出前200页的导航链接,结果1秒钟就刷出来了。这我才茅塞顿开,原来是输出内容太多导致的。以前遇到性能问题都会去想数据库操作,从来没有想

2、到其他地方会不会有问题,或很少想其他地方。其实页面输出的数据量对性能也是有很大影响的,所以我们肯定要养成良好的程序书写习惯,力求简洁。 后来我对程序进行了优化,优化分两个步骤,第一个步骤我不将全部的导航都输出来,只输出前200多页,后面再加一个文本框用于导航。 同时我对每个链接进行了简化,原来每个上面都有很长的链接,至此我将链接放到了javascript函数中,然后再导航数字上只加上一个onclick大事。这样又可以削减许多输出数据。结果性能特别好。 原来的代码片断: font color=#008080 size=2当前font color=ff0000 =tcurpage/font页 共f

3、ont color=ff0000 =tpagecount/font页 br if ttotalcount0 then for i=1 to tpagecount a href=request.servervariables(path_info) ?page=ibrowsersize=browsersize t_count=ttotalcountorder_field=torderfield order_dir=torderdirectionotype=otype oop=oopokey=filterparam4(okey) page_size=tpagesize=add_option=i/a

4、if browsersize=1 then if i=20 or i=36 then response.write end if if i=fcou then exit for end if response.write next dim allstr if tpagecountfcou then for i=fcou+1 to tpagecount if browsersize=0 then m=(i=74 or i=107 or (i107 and (i-107) mod 27)=0) else m=(i=94 or i=130 or (i130 and (i-130) mod 35)=0

5、) end if allstr=allstr a href=request.servervariables(path_info)? page=ibrowsersize=browsersizet_count= ttotalcount order_field= torderfield order_dir= torderdirection otype= otype oop= oop okey= filterparam4 (okey) page_size= tpagesize add_option allstr=allstr i allstr=allstr /a if not m then allstr=allstr if m then allstr=allstr br if browsersize=1 then if i=58 or i=71 then allstr=allstr end if if i=106 then allstr=allstr next script language=javascript var allstr; allstr=allstr; /scripta href=# title=显示 更多信息请查看IT技术专栏 .

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 科普知识


经营许可证编号:宁ICP备18001539号-1