Comments (10)
Thanks Ilya. I agree there have to be better metrics available to compare against - the median is a good first step in moving away from the average. I'm happy to dive into the quantile approach you suggested too.
On the technical side, it appears there are a few existing modules for parsing data from bigquery, so it should in theory be relatively trivial to get the median in place. I may have to ask some follow up questions on reasoning quantiles for individual user queries.
from tmi.
@addyosmani the numbers don't change that much, I think we can just import + version a CSV with results. Here's a quick query:
SELECT * FROM
(SELECT 'desktop' type,
round(avg(round(bytesImg/1024))) average,
NTH(10, quantiles(round(bytesImg/1024))) p10,
NTH(20, quantiles(round(bytesImg/1024))) p25,
NTH(30, quantiles(round(bytesImg/1024))) p30,
NTH(50, quantiles(round(bytesImg/1024))) p40,
NTH(60, quantiles(round(bytesImg/1024))) p60,
NTH(70, quantiles(round(bytesImg/1024))) p70,
NTH(75, quantiles(round(bytesImg/1024))) p75,
NTH(80, quantiles(round(bytesImg/1024))) p80,
NTH(85, quantiles(round(bytesImg/1024))) p85,
NTH(90, quantiles(round(bytesImg/1024))) p90,
NTH(95, quantiles(round(bytesImg/1024))) p95
FROM [httparchive:runs.2014_10_15_pages]),
(SELECT 'mobile' type,
round(avg(round(bytesImg/1024))) average,
NTH(10, quantiles(round(bytesImg/1024))) p10,
NTH(20, quantiles(round(bytesImg/1024))) p25,
NTH(30, quantiles(round(bytesImg/1024))) p30,
NTH(50, quantiles(round(bytesImg/1024))) p40,
NTH(60, quantiles(round(bytesImg/1024))) p60,
NTH(70, quantiles(round(bytesImg/1024))) p70,
NTH(75, quantiles(round(bytesImg/1024))) p75,
NTH(80, quantiles(round(bytesImg/1024))) p80,
NTH(85, quantiles(round(bytesImg/1024))) p85,
NTH(90, quantiles(round(bytesImg/1024))) p90,
NTH(95, quantiles(round(bytesImg/1024))) p95
FROM [httparchive:runs.2014_10_15_pages_mobile]);
type,average,p10,p25,p30,p40,p60,p70,p75,p80,p85,p90,p95
desktop,1207.0,47.0,144.0,269.0,614.0,853.0,1189.0,1411.0,1706.0,2112.0,2762.0,4073.0
mobile,660.0,17.0,59.0,114.0,302.0,439.0,639.0,816.0,994.0,1232.0,1639.0,2513.0
from tmi.
That approach works for me. I've signed up for BigQuery and am happy to check-in and update the CSV periodically. Will let you know once we've updated to support medians. Shouldn't take long.
from tmi.
Implemented in branch. How do you feel about this for the output?
from tmi.
I think you're still average in your calculation, and I just realized that I omitted p50 in above query - doh.
What's your thinking behind asking the site author to get to a median? Seems like we should, instead, ask them to make it as small as possible to meet their use case: no reason to stop at p50, and sometimes (due to business requirements, etc), it may not be possible either. I'd suggest something like...
- Your image weight: 3.31MB
- Desktop: 90th percentile (median site: 700KB)
- Mobile: 95th percentile (median site: 350KB)
- needs some call to action at the end...
from tmi.
It's my turn to doh! :) I completely misread the field heading. You're right - we're still reading the average here.
What's your thinking behind asking the site author to get to a median?
The thought here was that getting them to quantify their image weight compared to how well/badly the rest of the web is doing, you had some incentive to work on trimming down your overall size of said images. Percentiles make more sense to use than averages however.
I'd suggest something like...
I'll get a version done that works as suggested. The revised query should be:
SELECT * FROM
(SELECT 'desktop' type,
round(avg(round(bytesImg/1024))) average,
NTH(10, quantiles(round(bytesImg/1024))) p10,
NTH(20, quantiles(round(bytesImg/1024))) p25,
NTH(30, quantiles(round(bytesImg/1024))) p30,
NTH(40, quantiles(round(bytesImg/1024))) p40,
NTH(50, quantiles(round(bytesImg/1024))) p50,
NTH(60, quantiles(round(bytesImg/1024))) p60,
NTH(70, quantiles(round(bytesImg/1024))) p70,
NTH(75, quantiles(round(bytesImg/1024))) p75,
NTH(80, quantiles(round(bytesImg/1024))) p80,
NTH(85, quantiles(round(bytesImg/1024))) p85,
NTH(90, quantiles(round(bytesImg/1024))) p90,
NTH(95, quantiles(round(bytesImg/1024))) p95
FROM [httparchive:runs.2014_10_15_pages]),
(SELECT 'mobile' type,
round(avg(round(bytesImg/1024))) average,
NTH(10, quantiles(round(bytesImg/1024))) p10,
NTH(20, quantiles(round(bytesImg/1024))) p25,
NTH(30, quantiles(round(bytesImg/1024))) p30,
NTH(40, quantiles(round(bytesImg/1024))) p40,
NTH(50, quantiles(round(bytesImg/1024))) p50,
NTH(60, quantiles(round(bytesImg/1024))) p60,
NTH(70, quantiles(round(bytesImg/1024))) p70,
NTH(75, quantiles(round(bytesImg/1024))) p75,
NTH(80, quantiles(round(bytesImg/1024))) p80,
NTH(85, quantiles(round(bytesImg/1024))) p85,
NTH(90, quantiles(round(bytesImg/1024))) p90,
NTH(95, quantiles(round(bytesImg/1024))) p95
FROM [httparchive:runs.2014_10_15_pages_mobile]);
does that look right?
from tmi.
Re, query: yep. Let's drop the average column, not even sure why I included it -- only thing it does is promote the bad practice.
The thought here was that getting them to quantify their image weight compared to how well/badly the rest of the web is doing, you had some incentive to work on trimming down your overall size of said images. Percentiles make more sense to use than averages however.
For the call to action, how about...
- Your image weight: 3.31MB
- Your site delivers more image bytes than 90% of desktop sites:
- +2.3MB compared to a site in 75th percentile
- +2.7MB compared to a site in 50th percentile
- +3.1MB compared to a site in 25th percentile
- Your site delivers more image bytes than 95% of mobile sites:
- ...
- Your site delivers more image bytes than 90% of desktop sites:
from tmi.
Current progress:
Next: Your site delivers more image bytes than X% of mobile sites:
from tmi.
from tmi.
Support for this has landed in master and should be in the next release.
from tmi.
Related Issues (17)
- Fix the breaking unit test
- CLI prints "psi" usage
- Crash with no images HOT 3
- Not giving accurate count HOT 3
- Does tmi checks images referenced from CSS? HOT 2
- Accept unhttped url HOT 1
- Feedback when request, timeout / url does not exist? HOT 1
- does this work on angular apps? HOT 1
- Unhandler error event HOT 9
- no output at all ! HOT 1
- Test app behind login? HOT 2
- Running TMI behind proxy HOT 1
- Does it work with Gulp? How?
- Cant run tmi properly HOT 3
- Elaborate median and percentile info in verbose output HOT 1
- Can't use tmi at all HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tmi.