Phantomjs is an engine that can be used across platforms. It uses js script policies and command lines to execute webkit for page loading and statistics.
YSlow: analyzes page elements to rate and grade pages.
Pagespeed analyzes page elements, rates and recommendations for modification. (Nginx and apache have related plug-ins. At the webserver layer, these elements that affect the page speed will be processed, such as compressing the blank space and merging multiple requests)
In terms of the time, connection time, and dns resolution time of the webpage space of phantomjs itself, webkit itself supports webinspector and has various element timelines. How to integrate the data to be further studied.
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.0 K (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.8 K (23828 bytes)
# Of requests (primed cache): 12
Statistics by component:
Doc:
# Of requests: 1
Size: 23.8 K (23828 bytes)
CSS:
# Of requests: 2
Size: 35.9 K (35967 bytes)
JS:
# Of requests: 5
Size: 79.6 K (79668 bytes)
Cssimage:
# Of requests: 3
Size: 5.0 K (5071 bytes)
Image:
# Of requests: 2
Size: 1.5 K (1512 bytes)
Favicon:
# Of requests: 1
Size: 0.0 K (0 bytes)
Statistics by component (primed cache ):
DOC:
# Of requests: 1
Size: 23.8 K (23828 bytes)
CSS:
# Of requests: 2
Size: 0.0 K (0 bytes)
JS:
# Of requests: 3
Size: 0.0 K (0 bytes)
Cssimage:
# Of requests: 3
Size: 0.0 K (0 bytes)
Image:
# Of requests: 2
Size: 0.0 K (0 bytes)
Favicon:
# Of requests: 1
Size: 0.0 K (0 bytes)
Direct command line
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
Data is very limited, waiting to continue integrating inspector