GithubHelp home page GithubHelp logo

Comments (10)

addyosmani avatar addyosmani commented on June 2, 2024

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.

igrigorik avatar igrigorik commented on June 2, 2024

@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]);

image

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.

addyosmani avatar addyosmani commented on June 2, 2024

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.

addyosmani avatar addyosmani commented on June 2, 2024

Implemented in branch. How do you feel about this for the output?

from tmi.

igrigorik avatar igrigorik commented on June 2, 2024

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.

addyosmani avatar addyosmani commented on June 2, 2024

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.

igrigorik avatar igrigorik commented on June 2, 2024

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:
      • ...

from tmi.

addyosmani avatar addyosmani commented on June 2, 2024

Current progress:

Next: Your site delivers more image bytes than X% of mobile sites:

from tmi.

igrigorik avatar igrigorik commented on June 2, 2024

image

from tmi.

addyosmani avatar addyosmani commented on June 2, 2024

Support for this has landed in master and should be in the next release.

from tmi.

Related Issues (17)

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.