From c183053e3f6e6ca635acc3a8c009065624ef0864 Mon Sep 17 00:00:00 2001 From: soulgalore Date: Sun, 15 Jan 2017 20:54:06 +0100 Subject: [PATCH] Removed User Timing performance advice: If you don't use user timings, you shouldn't get lower score #148 --- CHANGELOG.md | 10 +++++++--- lib/dom/info/userTiming.js | 14 ++++++++++++++ lib/dom/performance/userTiming.js | 28 ---------------------------- 3 files changed, 21 insertions(+), 31 deletions(-) create mode 100644 lib/dom/info/userTiming.js delete mode 100644 lib/dom/performance/userTiming.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 89271cee..908f9f50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ # CHANGELOG - webcoach +## UNRELEASED +### Changed +- Removed User Timing performance advice: If you don't use user timings, you shouldn't get lower score. See how this was broken https://github.com/sitespeedio/browsertime/issues/257 [#148](https://github.com/sitespeedio/coach/issues/148) + ## 0.30.4 2017-01-10 ### Added - Updated to latest Browserime beta-23 @@ -12,14 +16,14 @@ - Updated to latest Browserime beta-21 ## 0.30.1 2017-01-04 -### Added +### Added - Updated to latest Browserime beta-19 ## 0.30.0 2016-12-12 ### Added - Add --viewPort option to set browser window size for test, thank you @jsocol for the PR -- New advice "Avoid using incorrect mime types" thank you @lbod #204 +- New advice "Avoid using incorrect mime types" thank you @lbod #204 - New Browsertime and PageXray @@ -35,7 +39,7 @@ - Updated to latest Browserime beta-9 ## 0.28.3 2016-10-26 -### Fixed +### Fixed - Fix the labelOnInput advice (thanks @simonc!) ### Added diff --git a/lib/dom/info/userTiming.js b/lib/dom/info/userTiming.js new file mode 100644 index 00000000..93fbb43f --- /dev/null +++ b/lib/dom/info/userTiming.js @@ -0,0 +1,14 @@ +(function() { + 'use strict'; + + var mark = 0; + var measure = 0; + if (window.performance && window.performance.getEntriesByType) { + measure = window.performance.getEntriesByType('measure').length; + mark = window.performance.getEntriesByType('mark').length; + } + return { + marks: mark, + measures: measure + }; +})(); diff --git a/lib/dom/performance/userTiming.js b/lib/dom/performance/userTiming.js deleted file mode 100644 index b23e1f28..00000000 --- a/lib/dom/performance/userTiming.js +++ /dev/null @@ -1,28 +0,0 @@ -(function() { - 'use strict'; - - var doWeUseUserTimingAPI = false; - var message = 'Start using the User Timing API to measure specific metrics for your page.'; - - if (window.performance && window.performance.getEntriesByType) { - if (window.performance.getEntriesByType('measure').length > 0 || - window.performance.getEntriesByType('mark').length > 0) { - doWeUseUserTimingAPI = true; - message = ''; - } - } else { - message = 'NOTE: User timing is not supported in this browser.'; - } - - return { - id: 'userTiming', - title: 'Use the User Timing API to check your performance', - description: 'The User Timing API is a perfect way to start measuring specific and custom metrics for your site. Use it.', - advice: message, - score: doWeUseUserTimingAPI ? 100 : 0, - weight: 1, - offending: [], - tags: ['performance'] - }; - -})();