嗨,大家好我正在測試我的應用程序。使用螢火蟲,我發現我的應用程序非常慢,需要加速。我的頁面加載時間過長!我怎樣才能減少頁面加載時間!
我有一個超過700KB的巨大組合JavaScript文件,其中包括我所有的js庫,但鬼的部分是代碼本身需要20到40秒之間的任何運行。現在的事情是我的代碼基於zend框架並從郵件文件夾中檢索郵件 - 但是這太慢了。我怎樣才能加快速度 - 我如何判斷代碼的哪個部分正在收費?
========================
的JavaScript然而在同一時間的iissue的一部分,另一個問題是,頁面我正在討論通過電子郵件收件箱進行的特定閱讀。它是一個Webmail界面的前端,有數據庫調用正在進行,但時間似乎可以忽略不計。看看我使用microtime計算得到消息和代碼片段的時間。
我花時間爲每個代碼片段運行並在報告中附加一個標籤給他們,這就是結果 - 第一個數字是以微秒爲單位的時間,而數字i爲該片段的標籤代碼花了時間。我應該關注哪些片段。那些帶有重複標籤的標籤如此循環運行 - 它是一個電子郵件客戶端,每條消息都作爲一個循環來檢索。
[Log Entry 2010-07-10T10:49:44+00:00] 0.000446:::::01
[Log Entry 2010-07-10T10:49:45+00:00] -0.100127:::::02
[Log Entry 2010-07-10T10:49:46+00:00] 0.191738:::::get message
[Log Entry 2010-07-10T10:49:46+00:00] 2.0E-5:::::get headers
[Log Entry 2010-07-10T10:49:46+00:00] 0.000776:::::contacts check
[Log Entry 2010-07-10T10:49:46+00:00] 0.174134:::::non multipart
[Log Entry 2010-07-10T10:49:47+00:00] -0.842978:::::get message
[Log Entry 2010-07-10T10:49:47+00:00] 1.2E-5:::::get headers
[Log Entry 2010-07-10T10:49:47+00:00] 0.000834:::::contacts check
[Log Entry 2010-07-10T10:49:47+00:00] 0.179016:::::non multipart
[Log Entry 2010-07-10T10:49:48+00:00] -0.851685:::::get message
[Log Entry 2010-07-10T10:49:48+00:00] 1.8E-5:::::get headers
[Log Entry 2010-07-10T10:49:48+00:00] 0.001334:::::contacts check
[Log Entry 2010-07-10T10:49:49+00:00] -0.587962:::::html part message
[Log Entry 2010-07-10T10:49:49+00:00] 0.138799:::::get message
[Log Entry 2010-07-10T10:49:49+00:00] 1.9E-5:::::get headers
[Log Entry 2010-07-10T10:49:49+00:00] 0.002155:::::contacts check
[Log Entry 2010-07-10T10:49:49+00:00] 0.181675:::::non multipart
[Log Entry 2010-07-10T10:49:50+00:00] -0.856142:::::get message
[Log Entry 2010-07-10T10:49:50+00:00] 1.6E-5:::::get headers
[Log Entry 2010-07-10T10:49:50+00:00] 0.000803:::::contacts check
[Log Entry 2010-07-10T10:49:50+00:00] 0.178046:::::non multipart
[Log Entry 2010-07-10T10:49:50+00:00] 0.141544:::::get message
[Log Entry 2010-07-10T10:49:50+00:00] 1.8E-5:::::get headers
[Log Entry 2010-07-10T10:49:51+00:00] 0.001167:::::contacts check
[Log Entry 2010-07-10T10:49:52+00:00] -0.188653:::::html part message
[Log Entry 2010-07-10T10:49:52+00:00] 0.148198:::::get message
[Log Entry 2010-07-10T10:49:52+00:00] 2.0E-5:::::get headers
[Log Entry 2010-07-10T10:49:53+00:00] 0.00284:::::contacts check
[Log Entry 2010-07-10T10:49:53+00:00] 0.336415:::::html part message
[Log Entry 2010-07-10T10:49:53+00:00] 0.140683:::::get message
[Log Entry 2010-07-10T10:49:53+00:00] 2.0E-5:::::get headers
[Log Entry 2010-07-10T10:49:54+00:00] 0.003539:::::contacts check
[Log Entry 2010-07-10T10:49:54+00:00] 0.311735:::::html part message
[Log Entry 2010-07-10T10:49:54+00:00] 0.143097:::::get message
[Log Entry 2010-07-10T10:49:54+00:00] 1.9E-5:::::get headers
[Log Entry 2010-07-10T10:49:55+00:00] 0.001392:::::contacts check
[Log Entry 2010-07-10T10:49:55+00:00] 0.313101:::::html part message
[Log Entry 2010-07-10T10:49:55+00:00] 0.146926:::::get message
[Log Entry 2010-07-10T10:49:55+00:00] 1.7E-5:::::get headers
[Log Entry 2010-07-10T10:49:55+00:00] 0.000743:::::contacts check
[Log Entry 2010-07-10T10:49:56+00:00] 0.173081:::::non multipart
並不多。儘管如此,我的互聯網連接需要大約15-20秒才能加載。這不是那裏最慢的連接......只有JavaScript的700K是巨大的! – EFraim 2010-07-10 11:05:20
請檢查我的更新後的問題 – Ali 2010-07-10 11:11:19
如果你認爲它只是由於那個大的JavaScript文件,將該文件分成較小的文件,並且只包括那些每個頁面需要的文件。如果你使用的是jQuery或類似的東西,包括它通過自己的鏈接更好,而不是將其複製到你的服務器,並從那裏包括它。 – 2010-07-10 11:23:03