頁面品質整體評估

來源:互聯網
上載者:User

phantomjs,作為引擎,可跨平台,以js指令碼策略,命令列的執行webkit,進行頁面載入和統計資訊。

YSlow,分析頁面元素,可對頁面進行評分和評級

pagespeed, 分析頁面元素,進行評分和修改建議。(nginx和apache有相關的外掛程式,在webserver層面將對這些影響頁面速度的元素進行處理,比如壓縮空白,合并多個請求等)

phantomjs本身的webpage空間的時間方面,連線時間,和dns解析時間等還沒有,但是webkit本身是支援webinspector,各種元素時間軸都有的。如何整合待進一步研究。

Use YSlow and PhantomJS to evaluate page performance

$ wget https://github.com/downloads/marcelduran/yslow/yslow-phantomjs-3.1.1.zip
$ unzip yslow-phantomjs-3.1.1.zip
$ cp yslow.js ~/lib/js/

$ phantomjs ~/lib/js/yslow.js --info basic  "http://test.example.com"
{
    "w":146046,
    "o":84,
    "u":"http%3A%2F%2Ftest.example.com",
    "r":14,
    "i":"ydefault",
    "lt":1103
}

overall score: B (84)
url: http://test.example.com
# of requests: 14
ruleset: ydefault
page load time: 1103

Use YSlow and PhantomJS to gather page statistics

$ phantomjs ~/lib/js/yslow.js --info stats --format plain "http://test.example.com"

size: 146.0K (146046 bytes)
overall score: B (84)
url: http://test.example.com
# of requests: 14
ruleset: ydefault
page load time: 1103
page size (primed cache): 23.8K (23828 bytes)
# of requests (primed cache): 12
statistics by component:
    doc:
        # of requests: 1
        size: 23.8K (23828 bytes)
    css:
        # of requests: 2
        size: 35.9K (35967 bytes)
    js:
        # of requests: 5
        size: 79.6K (79668 bytes)
    cssimage:
        # of requests: 3
        size: 5.0K (5071 bytes)
    image:
        # of requests: 2
        size: 1.5K (1512 bytes)
    favicon:
        # of requests: 1
        size: 0.0K (0 bytes)
statistics by component (primed cache):
    doc:
        # of requests: 1
        size: 23.8K (23828 bytes)
    css:
        # of requests: 2
        size: 0.0K (0 bytes)
    js:
        # of requests: 3
        size: 0.0K (0 bytes)
    cssimage:
        # of requests: 3
        size: 0.0K (0 bytes)
    image:
        # of requests: 2
        size: 0.0K (0 bytes)
    favicon:
        # of requests: 1
        size: 0.0K (0 bytes)

直接命令列

 npm install yslow -g yslow --info basic --format plain igvita.har    size: 67.0K (67000 bytes)    overall score: A (94)    url: http://www.igvita.com/    # of requests: 9    ruleset: ydefault    page load time: 821

Use PhantomJS and the netsniff.js to generate a HAR file

$ phantomjs ~/lib/js/netsniff.js"http://test.example.com"
> ~/tmp/example.har

資料很有限,等待繼續整合inspector

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.