English | 中文

🚀 A statistical analysis tool for performance testing
Hiper
The name is short for Hi performance Or High performance
Important
Hi guys, Please present your issue in English
请使用英语提issue
Install
npm install hiper -g
The output

PerformanceTiming

| DNS lookup time | domainLookupEnd - domainLookupStart |
| TCP connect time | connectEnd - connectStart |
| TTFB | responseStart - requestStart |
| Download time of the page | responseEnd - responseStart |
| After DOM Ready download time | domComplete - domInteractive |
| White screen time | domInteractive - navigationStart |
| DOM Ready time | domContentLoadedEventEnd - navigationStart |
| Load time | loadEventEnd - navigationStart |
https://developer.mozilla.org/en-US/docs/Web/API/PerformanceTiming
Usage
hiper --help
Usage: hiper [options] [url]
🚀 A statistical analysis tool for performance testing
Options:
-v, --version output the version number
-n, --count <n> specified loading times (default: 20)
-c, --config <path> load the configuration file
-u, --useragent <ua> to set the useragent
-H, --headless [b] whether to use headless mode (default: true)
-e, --executablePath <path> use the specified chrome browser
--no-cache disable cache (default: false)
--no-javascript disable javascript (default: false)
--no-online disable network (defalut: false)
-h, --help output usage information
For instance
hiper baidu.com
hiper "baidu.com?a=1&b=2"
hiper -n 100 "baidu.com?a=1&b=2"
hiper -n 100 "baidu.com?a=1&b=2" --no-cache
hiper -n 100 "baidu.com?a=1&b=2" --no-javascript
hiper -n 100 "baidu.com?a=1&b=2" -H false
hiper -n 100 "baidu.com?a=1&b=2" -u "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36"
Config
Support .json and .js config
{
"executablePath": "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
"url": "https://example.com",
"cookies": [{
"name": "token",
"value": "9+cL224Xh6VuRT",
"domain": "example.com",
"path": "/",
"size": 294,
"httpOnly": true
}],
"count": 100,
"headless": true,
"noCache": false,
"noJavascript": false,
"noOnline": false,
"useragent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36",
"viewport": {
"width": 375,
"height": 812,
"deviceScaleFactor": 3,
"isMobile": false,
"hasTouch": false,
"isLandscape": false
}
}
Having a JS file for config allows people to use ENV variables. For example, let's say I want to test the site on an authenticated state. I can pass some cookie that is used to identify me through ENV variables and having a JS based config file makes this simple. For example
module.exports = {
....
cookies: [{
name: 'token',
value: process.env.authtoken,
domain: 'example.com',
path: '/',
httpOnly: true
}],
....
}
hiper -c /home/config.json
hiper -c /home/config.js
Pain point
After we have developed a project or optimized the performance of a project,
how do we measure the performance of this project?
A common approach is to look at the data in the performance and network in the Dev Tool, record a few key performance metrics, and refresh them a few times before looking at those performance metrics,
Sometimes we find that due to the small sample size, the current Network/CPU/Memory load is heavily impacted, and sometimes the optimized project is slower than before the optimization.
If there is a tool, request web page many times, and then taking out the various performance indicators averaging, we can very accurately know the optimization is positive or negative.
In addition, you can also make a comparison and get accurate data about how much you have optimized. This tool is designed to solve the pain point.
At the same time, this tool is also a good tool for us to learn about the "browser's process of load and rendering" and "performance optimization", so that we don't get wrong conclusions when there are too few samples
Roadmap
- Better documentation
- i18n
- Increase the analysis statistics of resource items loaded on the page
- Statistical reports can be generated
- Data visualization
Contributing
- Fork it
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create new Pull Request
License
MIT
Welcome Star and PR
Copyright (c) 2018 liyanfeng(pod4g)