الإنجليزية | 中文
أداة تحليل إحصائية لاختبار الأداء
الاسم قصير للمراء لكل شكل أو مرحبًا GH لكل شكل
مرحبًا يا شباب ، يرجى تقديم مشكلتك باللغة الإنجليزية
请使用英语提 القضية
npm install hiper -g
# or use yarn:
# yarn global add hiper إشعار: It takes period (m)s to load ... period تعني أن هذا الاختبار يستغرق وقتًا . لذا ، صعد وترتفع الفترة. ليس خطأ
| مفتاح | قيمة |
|---|---|
| وقت البحث DNS | Domainlookupend - DomainlookupStart |
| TCP توصيل الوقت | Connectend - ConnectStart |
| TTFB | Responsestart - requestStart |
| تنزيل وقت الصفحة | Responseend - Responsestart |
| بعد وقت تحميل DOM جاهز | DomComplete - نشيط |
| وقت الشاشة البيضاء | ناشط - التنقل |
| وقت جاهز دوم | domcontentloadedeventend - NavigationStart |
| وقت تحميل | Loadeventend - NavigationStart |
https://developer.mozilla.org/en-us/docs/web/api/performancetiming
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على سبيل المثال
# We can omit the protocol header if has omitted, the protocol header will be `https://`
# The simplest usage
hiper baidu.com
# if the url has any parameter, surround the url with double quotes
hiper " baidu.com?a=1&b=2 "
# Load the specified page 100 times
hiper -n 100 " baidu.com?a=1&b=2 "
# Load the specified page 100 times without `cache`
hiper -n 100 " baidu.com?a=1&b=2 " --no-cache
# Load the specified page 100 times without `javascript`
hiper -n 100 " baidu.com?a=1&b=2 " --no-javascript
# Load the specified page 100 times with `headless = false`
hiper -n 100 " baidu.com?a=1&b=2 " -H false
# Load the specified page 100 times with set `useragent`
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 " .json و .js config {
// options Pointing to a specific chrome executable, this configuration is generally not required unless you want to test a specific version of chrome
"executablePath" : "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" ,
// required The url you want to test
"url" : "https://example.com" ,
// options Cookies required for this test. It's usually a cookie for login information Array | Object
"cookies" : [ {
"name" : "token" ,
"value" : "9+cL224Xh6VuRT" ,
"domain" : "example.com" ,
"path" : "/" ,
"size" : 294 ,
"httpOnly" : true
} ] ,
// options default: 20 Test times
"count" : 100 ,
// options default: true Whether to use headless mode
"headless" : true ,
// options default: false Disable cache
"noCache" : false ,
// options default: false Disable javascript
"noJavascript" : false ,
// options default: false Disable network
"noOnline" : false ,
// options Set the useragent information
"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" ,
// options Set the viewport information
"viewport" : {
// options
"width" : 375 ,
// options
"height" : 812 ,
// options default: 1 devicePixelRatio
"deviceScaleFactor" : 3 ,
// options default: false Whether to simulate mobile
"isMobile" : false ,
// options default: false Whether touch events are supported
"hasTouch" : false ,
// options default: false Is it horizontal or not
"isLandscape" : false
}
}يتيح وجود ملف JS للتكوين للأشخاص استخدام متغيرات ENV. على سبيل المثال ، دعنا نقول أنني أريد اختبار الموقع على حالة مصادقة. يمكنني تمرير بعض ملفات تعريف الارتباط التي يتم استخدامها لتحديد التعرف علي من خلال متغيرات ENV ووجود ملف التكوين القائم على JS يجعل هذا بسيطًا. على سبيل المثال
module . exports = {
... .
cookies : [ {
name : 'token' ,
value : process . env . authtoken ,
domain : 'example.com' ,
path : '/' ,
httpOnly : true
} ] ,
... .
} # Load the above configuration file (Let's say this file is under /home/)
hiper -c /home/config.json
# Or you can also use JS files for configuration
hiper -c /home/config.jsبعد تطوير مشروع أو تحسين أداء المشروع ،
كيف نقيس أداء هذا المشروع؟
هناك طريقة شائعة تتمثل في النظر إلى البيانات الموجودة في performance network في Dev Tool ، وتسجيل بعض مقاييس الأداء الرئيسية ، وتحديثها عدة مرات قبل النظر إلى مقاييس الأداء هذه ،
في بعض الأحيان ، نجد أنه نظرًا لصغر حجم العينة ، فإن حمل الشبكة/وحدة المعالجة المركزية/الذاكرة الحالية يتأثر بشدة ، وأحيانًا يكون المشروع الأمثل أبطأ من قبل التحسين.
إذا كانت هناك أداة ، واطلب صفحة الويب عدة مرات ، ثم إخراج مؤشرات الأداء المختلفة ، يمكننا أن نعرف بدقة أن التحسين إيجابي أو سلبي.
بالإضافة إلى ذلك ، يمكنك أيضًا إجراء مقارنة والحصول على بيانات دقيقة حول المبلغ الذي قمت بتحسينه . تم تصميم هذه الأداة لحل نقطة الألم.
في الوقت نفسه ، تعتبر هذه الأداة أيضًا أداة جيدة لنا للتعرف على "عملية الحمل وتقديم المتصفح" و "تحسين الأداء" ، بحيث لا نحصل على استنتاجات خاطئة عندما يكون هناك عدد قليل جدًا من العينات
معهد ماساتشوستس للتكنولوجيا
مرحبًا
حقوق الطبع والنشر (C) 2018 Liyanfeng (POD4G)