亚洲免费乱码视频,日韩 欧美 国产 动漫 一区,97在线观看免费视频播国产,中文字幕亚洲图片

      1. <legend id="ppnor"></legend>

      2. 
        
        <sup id="ppnor"><input id="ppnor"></input></sup>
        <s id="ppnor"></s>

        asp:頁面輸出太多會嚴重影響web程序的性能

        字號:


            數(shù)據(jù)量增加的很快,最近發(fā)現(xiàn)它的性能非常差,每次打開都需要十幾秒,甚至幾十秒,因為我
            的程序分頁用的是我自己的分頁程序:
            難道這個分頁程序有問題,但是其他地方用到它沒有感覺到慢呀,我沒事就琢磨他,到網(wǎng)上查資料,結(jié)果沒有具體查到說到我的那個分頁程序性能差的相關資料,后來我發(fā)現(xiàn)我的程序中的頁導航用的是數(shù)字導航方法,而且所有的頁導航的數(shù)字全都輸出來了,一共一千多頁,能不能使這個地方慢呢?我決定測試一下,所以,我就只讓他輸出前200頁的導航鏈接,結(jié)果1秒鐘就刷出來了。這我才恍然大悟,原來是輸出內(nèi)容太多導致的。以前遇到性能問題都會去想數(shù)據(jù)庫操作,從來沒有想到其他地方會不會有問題,或很少想其他地方。其實頁面輸出的數(shù)據(jù)量對性能也是有很大影響的,所以我們一定要養(yǎng)成良好的程序書寫習慣,力求簡單。
            后來我對程序進行了優(yōu)化,優(yōu)化分兩個步驟,第一個步驟我不將所有的導航都輸出來,只輸出前200多頁,后面再加一個文本框用于導航。
            同時我對每個鏈接進行了簡化,原來每個上面都有很長的鏈接,至此我將鏈接放到了javascript函數(shù)中,然后再導航數(shù)字上只加上一個onclick事件。這樣又可以減少很多輸出數(shù)據(jù)。結(jié)果性能非常好。
            原來的代碼片斷:
            <font color=#008080 size=2>當前<font color=ff0000>
            <%=tcurpage%></font>頁 共<font color=ff0000>
            <%=tpagecount%></font>頁
            <br><% if ttotalcount>0 then
            for i=1 to tpagecount
            %><a href='<%=request.servervariables(path_info)%>
            ?page=<%=i%>&browsersize=<%=browsersize%>
            &t_count=<%=ttotalcount%>&order_field=<%=torderfield%>
            &order_dir=<%=torderdirection%>&otype=<%=otype%>
            &oop=<%=oop%>&okey=<%=filterparam4(okey)%>
            &page_size=<%=tpagesize%><%=add_option%>'><%=i%></a>
            <% 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 tpagecount>fcou then
            for i=fcou+1 to tpagecount
            if browsersize=0 then
            m=(i=74 or i=107 or (i>107 and ((i-107) mod 27)=0))
            else
            m=(i=94 or i=130 or (i>130 and ((i-130) mod 35)=0))
            end if
            allstr=allstr & <a href='&request.servervariables(path_info)&?
            page=&i&&browsersize=&browsersize&&t_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%>;
            </script><a href=# title=顯示