Giter VIP home page Giter VIP logo

coach's Introduction

The coach

The coach

The coach helps you find performance problems on your web page. You can think of the coach as a modern version of YSlow.

The core functionality of the Coach has been moved to Coach-core.

The easiest way to use the Coach is to run sitespeed.io.

coach's People

Contributors

a5hleyrich avatar anselmbradford avatar atdt avatar beenanner avatar bronzehedwick avatar charliepark avatar danielruf avatar greenkeeper[bot] avatar greenkeeperio-bot avatar jadonn avatar jsocol avatar keithamus avatar lbod avatar martinfaartoft avatar matthojo avatar pborreli avatar raulbrito avatar rickycodes avatar simonc avatar sodabrew avatar soulgalore avatar sumeetrohra avatar tobli avatar xhmikosr avatar xit4 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

coach's Issues

Better handling of JQuery check

[2016-05-12 09:48:57] http://www.svensktnaringsliv.se generated the following errors in the coach {
  "performance": {
    "jquery": "Cannot read property 'jquery' of undefined"
  }
}
[2016-05-12 10:48:27] http://www.norrkoping.se generated the following errors in the coach {
  "performance": {
    "jquery": "window.jQuery.fn is undefined"
  }
}

Firefox requirement?

Is Firefox an absolute requirement for coach, and should it be listed as such in the ReadMe file? Working with a fresh install I was presented with BrowserError: Could not locate Firefox on the current system and a subsequent failure. Should coach continue, or fail at this point?

Error when running on Firefox 47

C:\>ver

Microsoft Windows [Version 6.1.7601]

C:\>node -v && npm -v
v6.2.0
3.8.9

C:\>webcoach --version
webcoach 0.22.4

C:\>webcoach https://www.sitespeed.io
Error running advice:  BrowserError: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:58403
    at BrowsertimeError (C:\Users\xmr\AppData\Roaming\npm\node_modules\webcoach\node_modules\browsertime\lib\support\errors.js:5:5)
    at BrowserError (C:\Users\xmr\AppData\Roaming\npm\node_modules\webcoach\node_modules\browsertime\lib\support\errors.js:13:5)
    at startBrowser.call.catch.tap.tap.catch.catch (C:\Users\xmr\AppData\Roaming\npm\node_modules\webcoach\node_modules\browsertime\lib\core\seleniumRunner.js:73:15)
    at tryCatcher (C:\Users\xmr\AppData\Roaming\npm\node_modules\webcoach\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (C:\Users\xmr\AppData\Roaming\npm\node_modules\webcoach\node_modules\bluebird\js\release\promise.js:502:31)
    at Promise._settlePromise (C:\Users\xmr\AppData\Roaming\npm\node_modules\webcoach\node_modules\bluebird\js\release\promise.js:559:18)
    at Promise._settlePromise0 (C:\Users\xmr\AppData\Roaming\npm\node_modules\webcoach\node_modules\bluebird\js\release\promise.js:604:10)
    at Promise._settlePromises (C:\Users\xmr\AppData\Roaming\npm\node_modules\webcoach\node_modules\bluebird\js\release\promise.js:679:18)
    at Async._drainQueue (C:\Users\xmr\AppData\Roaming\npm\node_modules\webcoach\node_modules\bluebird\js\release\async.js:138:16)
    at Async._drainQueues (C:\Users\xmr\AppData\Roaming\npm\node_modules\webcoach\node_modules\bluebird\js\release\async.js:148:10)
    at Immediate.Async.drainQueues [as _onImmediate] (C:\Users\xmr\AppData\Roaming\npm\node_modules\webcoach\node_modules\bluebird\js\release\async.js:17:14)
    at tryOnImmediate (timers.js:543:15)
    at processImmediate [as _immediateCallback] (timers.js:523:5)

Add another cache rule

In 3.X we have two cache rules: One if your asset is missing cache headers with higher weight, and one where the check is for long cache headers (with lower weight).

Option to save .har file

Is this something you guys would be interested in adding to Coach? I propose a new option which accepts a file path and saves the generated .har file?

webcoach -u http://www.sitespeed.io --browser firefox --har /path/to/output.har

I've implemented this locally, but thought I'd ask before raising a PR.

Cli table output: Don't break words in advice output

In the current version we insert a newline at an exact position. Instead it should insert it before a space, so that words aren't cut in the output.

Today it can look like this:

The page has 1 request(s) that have a shorter cache t
ime than 1 month. Can you increase them?

And it should be:

The page has 1 request(s) that have a shorter cache 
time than 1 month. Can you increase them?

Add a no color command line switch

I'd like the an option on the command line to turn off color output in the table view, with something like --no-color. I would like to generate reports using this tool, but the ANSI color codes make the output hard to read.

Some unrealistic advice for SPA applications

I really like the tool, as it has pointed out some performance and accessibility gaps in a few of my applications. However, one piece of advice that its not accurate on is the 'Javascript Size' of my angular/react applications.

For Example:

javascriptSize: The total Javascript transfer size is 288.6 kB and the uncompressed size is 880.2 kB. This is too much. You need to remove as much as possible.

I'm using gzip and js minification, and feel that the size of ~300kb is excellent, considering i'm compressing 23 different necessary vendor libraries (Angular, Stripe, Google Tag Manager, Sentry, etc) including the app scripts itself, a total 105 different scripts. As a baseline, I am comfortably below the average website JS size (363kb as of 2015, estimated +400kb in 2016).

I think the coach should give realistic advice in this area where spa applications are considered. Including analysis of gzip/minification should be present, and perhaps library detection as well? For instance, on separate website, i'm using both angular and react, or angular 1 and 2, or angular and jquery, and if multiple front-end libraries like this are detected, it should recommend that I only use one.

Handle response images in 'avoidscailingimaqges' advice.

If avoidscailingimaqges advice can report incorrect image urls for img tags with srcset, but no src. http://www.aftonbladet.se/ is one such size (at least at the time of reporting). Since no src is present, the url get's reported as http://www.aftonbladet.se/.

Finding candidate images can be done with the following snippet:
Array.prototype.slice.call(document.getElementsByTagName('img')).filter((img) => img.src === '')

The coach needs to consider srcset, and update advice accordingly.

Make it easy to add your own advice

One thing that is missing is that we should make it super easy to add your own advice. It would be cool that you can do it using the CLI standalone but also for other tools that uses the coach (sitespeed.io at the moment).

Bookmarklet

It would be great if the coach could be a bookmarklet. We done the concatenation and logs all the data to the console. But what we really want is a HTML-bookmarklet.

I'm a fan of the DOM monster something like that would be cool. A summary first, displaying when you got a score below 100. Or something :)

Windows installation

Is there a way to install coach in windows? I got the following error below from the command prompt, it seems a simple enough problem, that the installer assumes '/' is the directory separator.

[email protected] combine C:\Dev\coach
mkdirp dist && tools/combine.js dist/coach.js

'tools' is not recognized as an internal or external command,
operable program or batch file.

command line output.txt

npm-debug.log.txt

Error getting HAR from FF

http://sj.se

[2016-02-28 14:56:30] Error from Firefox HAR generation: {"message":"JSON.parse is not a function","stackTrace":[{"methodName":"anonymous/triggerExport/<","fileName":"http://www.sj.se/ line 69 > Function","lineNumber":7,"columnNumber":29}]}
Error running advice:  { message: 'JSON.parse is not a function',
  stackTrace: 
   [ { methodName: 'anonymous/triggerExport/<',
       fileName: 'http://www.sj.se/ line 69 > Function',
       lineNumber: 7,
       columnNumber: 29 } ] }

Simplify the API

We need to flatten the API and use the same method names for both DOM and HAR.

HTTP/2 and the coach

One thing that stops the coach from beeing released is making Browsertime handle HTTP/2 connections. It works fine right now without Browsermob Proxy, but we want the proxy to generate the HAR file and we need the HAR to do all the advice.

Tobias has started on generating the HAR directly from Firefox using https://github.com/firebug/har-export-trigger:
https://github.com/tobli/browsertime/tree/1_0/firefox-har

And also started generating a HAR from the Chrome logs. It could be though, that we could build a plugin to Chrome that just fetched the HAR from the network panel. And a plugin to use the built in throttling.

Allow overriding browser location

Coach doesn't find Firefox/Chrome if they were installed with homebrew cask. Paths are in the form of /opt/homebrew-cask/Caskroom/firefox/[version]/Firefox.app

Add info for Service workers

Browsertime has support for running JS, so we can use it to check for service workers. Needs some re-structuring in the coach so we also support running async.

Info: Screenshot

Ability to return a screenshot of the rendered page as binary data. Possibly add the -s option to toggle the inclusion. Similar to what PageSpeed does.

Integrate HAR and DOM advice

  • create a new runner in bin that uses Browsertime with experimental.nativeHar, run the DOM advice, run the HAR advice on the generated HAR and then combine and log the result.
  • setup functions to combine the advice and re-calculate the score for performance and overall.

How to handle injected CSS and JS inside of head

We have a flaw in the system today, the coach don't know if a javascript or css is injected into head. Some of the advice gets screwed by that. We need to discuss how we can fix that, have a couple of ideas and will write them down later today.

Info: Requests and Sizes

I would love to see requests and sizes added to the info for the following assets:

  • Total
  • CSS
  • JS
  • Font
  • Images

Combine DOM & HAR for even smarter advice

Evaluating the HAR advice for performance would benefit of knowing which assets are render blocking (or at least CSS inside head and JS that are synchronously loaded). If we would feed the info result to the HAR advice, it would be possible to use that. Not 100% sure though how the advice would change :)

Different page size in Chrome & Firefox

This is coming from the HAR files, could be a bug in snufkin or Browsertime, or Chrome/Firefox. Or could it be different DPI? Lets investigate.

 $ bin/webcoach.js -u https://en.wikipedia.org/wiki/Barack_Obama -b chrome

...
The page total transfer size is 3.8 MB, which is more than the limit 2 MB. That is really big and you should check what you can do to make it smaller. 

$ bin/webcoach.js -u https://en.wikipedia.org/wiki/Barack_Obama -b firefox
....
The page total transfer size is 2.1 MB, which is more than the limit 2 MB. That is really big and you should check what you can do to make it smaller.

Getting error while installing

I'm getting error installing webcoach

$ npm i webcoach -g
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm WARN deprecated [email protected]: cross-spawn no longer requires a build toolchain, use it instead!
npm ERR! registry error parsing json
npm ERR! Linux 4.4.0-21-generic
npm ERR! argv "/home/rw/.nvm/versions/node/v6.2.0/bin/node" "/home/rw/.nvm/versions/node/v6.2.0/bin/npm" "i" "webcoach" "-g"
npm ERR! node v6.2.0
npm ERR! npm  v3.8.9

npm ERR! Unexpected token < in JSON at position 1
npm ERR! 
npm ERR! <?xml version="1.0" encoding="utf-8"?>
npm ERR! <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
npm ERR!  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
npm ERR! <html>
npm ERR!   <head>
npm ERR!     <title>503 No healthy backends</title>
npm ERR!   </head>
npm ERR!   <body>
npm ERR!     <h1>Error 503 No healthy backends</h1>
npm ERR!     <p>No healthy backends</p>
npm ERR!     <h3>Guru Mediation:</h3>
npm ERR!     <p>Details: cache-fra1246-FRA 1464071385 1600019676</p>
npm ERR!     <hr>
npm ERR!     <p>Varnish cache server</p>
npm ERR!   </body>
npm ERR! </html>
npm ERR! 
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /home/rw/npm-debug.log

Error while running the url with webcoach

Keyurs-MacBook-Air:~ FamilyMac$ webcoach -u http://www.sitespeed.io --browser firefox
/usr/local/lib/node_modules/webcoach/bin/webcoach.js:5
let fs = require('fs'),
^^^
SyntaxError: Unexpected strict mode reserved word
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3

Using loadTimes when testing on Firefox

[2016-05-12 10:40:52] http://www.rtl.lu generated the following errors in the coach {
  "bestpractice": {
    "httpsH2": "window.chrome.loadTimes is not a function",
    "spdy": "window.chrome.loadTimes is not a function"
  },
  "info": {
    "connectionType": "window.chrome.loadTimes is not a function"
  },
  "performance": {
    "fastRender": "window.chrome.loadTimes is not a function",
    "inlineCss": "window.chrome.loadTimes is not a function"
  }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.