Skip to content

Commit

Permalink
Merge branch 'main' of github.com:HTTPArchive/almanac.httparchive.org…
Browse files Browse the repository at this point in the history
… into production
  • Loading branch information
tunetheweb committed Oct 25, 2022
2 parents d51c905 + 217a6d7 commit d05735a
Show file tree
Hide file tree
Showing 117 changed files with 4,323 additions and 220 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/add-to-release-notes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ jobs:
if: github.repository == 'HTTPArchive/almanac.httparchive.org'
steps:
- name: Update release notes
uses: release-drafter/[email protected].0
uses: release-drafter/[email protected].1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37 changes: 37 additions & 0 deletions sql/2022/performance/bfcache_cachecontrol_nostore.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
CREATE TEMP FUNCTION HAS_NO_STORE_DIRECTIVE(cache_control STRING) RETURNS BOOL AS (
REGEXP_CONTAINS(cache_control, r'(?i)\bno-store\b')
);

WITH requests AS (
SELECT
client,
rank,
LOGICAL_OR(HAS_NO_STORE_DIRECTIVE(JSON_VALUE(payload, '$._cacheControl'))) AS includes_ccns
FROM
`httparchive.almanac.summary_response_bodies`
WHERE
date = '2022-06-01' AND
firstHtml
GROUP BY
client,
rank,
page
)

SELECT
client,
_rank AS rank,
COUNTIF(includes_ccns) AS pages,
COUNT(0) AS total,
COUNTIF(includes_ccns) / COUNT(0) AS pct
FROM
requests,
UNNEST([1000, 10000, 100000, 1000000, 10000000]) AS _rank
WHERE
rank <= _rank
GROUP BY
client,
rank
ORDER BY
rank,
client
40 changes: 40 additions & 0 deletions sql/2022/performance/bfcache_unload.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
WITH lh AS (
SELECT
_TABLE_SUFFIX AS client,
url AS page,
JSON_VALUE(report, '$.audits.no-unload-listeners.score') = '0' AS has_unload
FROM
`httparchive.lighthouse.2022_06_01_*`
),

pages AS (
SELECT
_TABLE_SUFFIX AS client,
url AS page,
rank
FROM
`httparchive.summary_pages.2022_06_01_*`
)


SELECT
client,
_rank AS rank,
COUNTIF(has_unload) AS pages,
COUNT(0) AS total,
COUNTIF(has_unload) / COUNT(0) AS pct
FROM
lh
JOIN
pages
USING
(client, page),
UNNEST([1000, 10000, 100000, 1000000, 10000000]) AS _rank
WHERE
rank <= _rank
GROUP BY
client,
rank
ORDER BY
rank,
client
25 changes: 25 additions & 0 deletions sql/2022/performance/cls_animations.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
WITH lh AS (
SELECT
_TABLE_SUFFIX AS client,
ARRAY_LENGTH(JSON_QUERY_ARRAY(report, '$.audits.non-composited-animations.details.items')) AS num_animations
FROM
`httparchive.lighthouse.2022_06_01_*`
)


SELECT
percentile,
client,
APPROX_QUANTILES(num_animations, 1000)[OFFSET(percentile * 10)] AS num_animations,
COUNTIF(num_animations > 0) AS pages,
COUNT(0) AS total,
COUNTIF(num_animations > 0) / COUNT(0) AS pct
FROM
lh,
UNNEST([10, 25, 50, 75, 90, 100]) AS percentile
GROUP BY
percentile,
client
ORDER BY
percentile,
client
24 changes: 24 additions & 0 deletions sql/2022/performance/cls_unsized_image_height.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
WITH lh AS (
SELECT
_TABLE_SUFFIX AS client,
CAST(JSON_VALUE(unsized_image, '$.node.boundingRect.height') AS INT64) AS height
FROM
`httparchive.lighthouse.2022_06_01_*`,
UNNEST(JSON_QUERY_ARRAY(report, '$.audits.unsized-images.details.items')) AS unsized_image
)


SELECT
percentile,
client,
APPROX_QUANTILES(height, 1000)[OFFSET(percentile * 10)] AS height,
COUNT(0) AS unsized_images
FROM
lh,
UNNEST([10, 25, 50, 75, 90, 100]) AS percentile
GROUP BY
percentile,
client
ORDER BY
percentile,
client
25 changes: 25 additions & 0 deletions sql/2022/performance/cls_unsized_images.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
WITH lh AS (
SELECT
_TABLE_SUFFIX AS client,
ARRAY_LENGTH(JSON_QUERY_ARRAY(report, '$.audits.unsized-images.details.items')) AS num_unsized_images
FROM
`httparchive.lighthouse.2022_06_01_*`
)


SELECT
percentile,
client,
APPROX_QUANTILES(num_unsized_images, 1000)[OFFSET(percentile * 10)] AS num_unsized_images,
COUNTIF(num_unsized_images > 0) AS pages,
COUNT(0) AS total,
COUNTIF(num_unsized_images > 0) / COUNT(0) AS pct
FROM
lh,
UNNEST([10, 25, 50, 75, 90, 100]) AS percentile
GROUP BY
percentile,
client
ORDER BY
percentile,
client
35 changes: 35 additions & 0 deletions sql/2022/performance/fid_long_tasks.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
WITH long_tasks AS (
SELECT
_TABLE_SUFFIX AS client,
url AS page,
CAST(JSON_QUERY(item, '$.duration') AS FLOAT64) AS long_task_duration
FROM
`lighthouse.2022_06_01_*`,
UNNEST(JSON_QUERY_ARRAY(report, '$.audits.long-tasks.details.items')) AS item
),

per_page AS (
SELECT
client,
page,
SUM(long_task_duration) AS long_tasks
FROM
long_tasks
GROUP BY
client,
page
)

SELECT
percentile,
client,
APPROX_QUANTILES(long_tasks, 1000)[OFFSET(percentile * 10)] AS long_tasks
FROM
per_page,
UNNEST([10, 25, 50, 75, 90, 100]) AS percentile
GROUP BY
percentile,
client
ORDER BY
percentile,
client
13 changes: 13 additions & 0 deletions sql/2022/performance/fid_tbt.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
SELECT
percentile,
_TABLE_SUFFIX AS client,
APPROX_QUANTILES(CAST(JSON_QUERY(report, '$.audits.total-blocking-time.numericValue') AS FLOAT64), 1000)[OFFSET(percentile * 10)] AS tbt
FROM
`httparchive.lighthouse.2022_06_01_*`,
UNNEST([10, 25, 50, 75, 90, 100]) AS percentile
GROUP BY
percentile,
client
ORDER BY
percentile,
client
15 changes: 15 additions & 0 deletions sql/2022/performance/js_bytes_rank.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
SELECT
IF(_rank < 10000000, CAST(_rank AS STRING), 'all') AS rank,
_TABLE_SUFFIX AS client,
APPROX_QUANTILES(bytesJS, 1001)[OFFSET(501)] / 1024 AS js_kbytes
FROM
`httparchive.summary_pages.2022_06_01_*`,
UNNEST([1000, 10000, 100000, 1000000, 10000000]) AS _rank
WHERE
rank <= _rank
GROUP BY
rank,
client
ORDER BY
rank,
client
36 changes: 36 additions & 0 deletions sql/2022/performance/lcp_bytes_distribution.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
WITH pages AS (
SELECT
_TABLE_SUFFIX AS client,
CAST(JSON_VALUE(payload, '$._metadata.page_id') AS INT64) AS pageid,
JSON_VALUE(payload, '$._performance.lcp_elem_stats.url') AS url
FROM
`httparchive.pages.2022_06_01_*`
),

requests AS (
SELECT
_TABLE_SUFFIX AS client,
pageid,
url,
respSize / 1024 AS kbytes
FROM
`httparchive.summary_requests.2022_06_01_*`
)

SELECT
percentile,
client,
APPROX_QUANTILES(kbytes, 1000)[OFFSET(percentile * 10)] AS kbytes
FROM
pages
JOIN
requests
USING
(client, pageid, url),
UNNEST([10, 25, 50, 75, 90, 100]) AS percentile
GROUP BY
percentile,
client
ORDER BY
percentile,
client
37 changes: 37 additions & 0 deletions sql/2022/performance/lcp_bytes_histogram.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
WITH pages AS (
SELECT
_TABLE_SUFFIX AS client,
CAST(JSON_VALUE(payload, '$._metadata.page_id') AS INT64) AS pageid,
JSON_VALUE(payload, '$._performance.lcp_elem_stats.url') AS url
FROM
`httparchive.pages.2022_06_01_*`
),

requests AS (
SELECT
_TABLE_SUFFIX AS client,
pageid,
url,
respSize / 1024 AS kbytes
FROM
`httparchive.summary_requests.2022_06_01_*`
)

SELECT
client,
IF(CEILING(kbytes / 100) * 100 < 1000, CAST(CEILING(kbytes / 100) * 100 AS STRING), '1000+') AS kbytes,
COUNT(0) AS freq,
SUM(COUNT(0)) OVER (PARTITION BY client) AS total,
COUNT(0) / SUM(COUNT(0)) OVER (PARTITION BY client) AS pct
FROM
pages
JOIN
requests
USING
(client, pageid, url)
GROUP BY
client,
kbytes
ORDER BY
client,
kbytes
19 changes: 0 additions & 19 deletions sql/2022/performance/lcp_discoverability.sql

This file was deleted.

36 changes: 36 additions & 0 deletions sql/2022/performance/lcp_format.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
WITH pages AS (
SELECT
_TABLE_SUFFIX AS client,
CAST(JSON_VALUE(payload, '$._metadata.page_id') AS INT64) AS pageid,
JSON_VALUE(payload, '$._performance.lcp_elem_stats.url') AS url
FROM
`httparchive.pages.2022_06_01_*`
),

requests AS (
SELECT
_TABLE_SUFFIX AS client,
pageid,
url,
format
FROM
`httparchive.summary_requests.2022_06_01_*`
)

SELECT
client,
format,
COUNT(0) AS freq,
SUM(COUNT(0)) OVER (PARTITION BY client) AS total,
COUNT(0) / SUM(COUNT(0)) OVER (PARTITION BY client) AS pct
FROM
pages
JOIN
requests
USING
(client, pageid, url)
GROUP BY
client,
format
ORDER BY
pct DESC
Loading

0 comments on commit d05735a

Please sign in to comment.