什麼才是提高ASP效能的最佳選擇(三)

來源:互聯網
上載者:User
結論
  本文第一部分的重要之處在於許多小事情的累積。為了強調這個問題,我設定了最後一個測試,在其中進行了我們以前曾經測試過的看來無所謂但實際上有壞影響的所有操作。我包含了許多Response.Write 聲明、關閉了緩衝器、設定了預設語言、去掉了Option Explicit 引用並初始化了錯誤控制代碼。
  < %@ LANGUAGE=VBSCRIPT % >
  < %
  On Error Resume Next
  FirstName = "John"
  …
  BirthDate = "1/1/1950"
  Response.Write("< html >")
  Response.Write("< head >")
  Response.Write(" < title >Response Test< /title >")
  Response.Write("< /head >")
  Response.Write("< body >")
  Response.Write("< h1 >Response Test< /h1 >")
  Response.Write("< table >")
  Response.Write("< tr >< td >< b >First Name:< /b >< /td >< td >" &_
"FirstName & "< /td >< /tr >")
  …
  Response.Write("< tr >< td >< b >Birth Date:< /b >< /td >< td >" &_
" BirthDate & "< /td >< /tr >")
  Response.Write("< /table >")
  Response.Write("< /body >")
  Response.Write("< /html >")
  % >
  /app2/final_1.asp片段
  基準值 = 5.57 msec/page
  反應時間 = 8.85 msec/page
  差 = +3.28 msec (58.9% 增加)
  聽起來可能很明顯,但是理解更重要,那就是我們放置在頁面上的代碼會對效能有影響。頁面上的小變化有時會大大地增加反應時間。
規則概括
  * 避免內聯ASP的過多使用。
  * 總是將連續Response.Write 語句串連進一個單獨語句內。
  * 永遠不要在Response.Write 周圍使用封裝函數以附加CRLF。
  * 如果必須格式化HTML輸出,直接在Response.Write 語句內附加CRLF。
  * 總是通過伺服器設定開啟緩衝器。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.