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.
Clear Eyes. Full Hearts. Can’t Lose.
License: MIT License
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.
Check if the page is using:
Should we add some advice about them? There's a lot that can go wrong with them.
Today the bookmarklet just dumps the advice to the console log. Lets create a frontend for the bookmarklet.
[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" } }
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?
Preload is coming, read @yoavweiss article for background:
https://www.smashingmagazine.com/2016/02/preload-what-is-it-good-for/
The coach should know about preload and give smart advice about when it can be used and when it shouldn't.
When we implemented the coachAdvice structure in the DOM result, the merge broke.
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)
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).
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.
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?
Being able to supply coach with a session cookie for the site being tested is necessary for sites that require a login to access.
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.
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.
Here's a list of some accessibility advice we should implement. Let's break it down and create issues for the most important ones:
http://aduggin.github.io/accessibility-fails/
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.
You can test it with:
bin/webcoach.js http://en.m.wikipedia.org -b firefox --mobile
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).
The coach should look for:
font-display: swap
and and overall look more into fonts. Checkout
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 :)
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.
[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 } ] }
With Chrome 51 h2 no longer works with NPN causing one of the tests to fail due to needing ALPN which is only supported in node.js >= 5.0 while using the http2 module for running tests.
We need to flatten the API and use the same method names for both DOM and HAR.
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.
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
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.
It's cool how https://github.com/MicrosoftEdge/static-code-scan has done the output. Lets make it possible to choose JSON output (as today) or a styled version.
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.
The way we check if a page is responsive isn't correct:
https://github.com/sitespeedio/coach/blob/master/lib/dom/info/responsive.js
It will only work if the width of the browser window is small, then it's correct. Would be cool of course to know this even when the browser window width is bigger.
We need to find a way to show the requests/responses that make the advice score lower ... maybe add an option add a extra row (with full colspan) and add them there? Ping @tobli
This is a bug in Firefox. HTTP/2 works fine.
We don't have any checks today that a page implementation of img, picture and srcset is ok. The coach should now about that!!
Flag users if their test page is https, but is serving non-https requests and list out what they are.
experimental.nativeHar
, run the DOM advice, run the HAR advice on the generated HAR and then combine and log the result.For HTTP/2 we can check that the transfer size of the CSS inside of head (or all CSS files) are within the magic limit of 14.5KB (10 packets). Change the combineCSS for HTTP/1 to something smarter :)
And make the cssInHead ready for https://jakearchibald.com/2016/link-in-body/
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.
I would love to see requests and sizes added to the info for the following assets:
Lets make it easy to track which version of the coach you are using.
Check if we can disable the favicon advice for FF for now.
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 :)
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.
I will try setting things up later today or tomorrow.
Today we use grunt-http-server as the server that serves our test cases (HTTP/1). We also need a server that serves HTTP2, so we can also test the HTTP2 advice.
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
Today the coach warn about css that are loaded outside of head but soon that will not be a anti pattern. We need to adjust the advice.
https://github.com/sitespeedio/coach/blob/master/lib/dom/performance/cssInHead.js
As reported by @tobli this could be something for the coach:
https://hacks.mozilla.org/2015/09/subresource-integrity-in-firefox-43/
https://hacks.mozilla.org/2016/04/how-to-implement-sri-into-your-build-process/
We could add an advice a put it in the best practice category for now.
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
[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" } }
Thank you - im testing this out now - trying to feed this data to elasticsearch/kibana - for initial review...
well - this is not an issue :) Just my way to express THANKX
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.