页面质量整体评估

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


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值