Skip to content

Commit 4538b65

Browse files
committed
Merge branch 'main' of github.com:HTTPArchive/almanac.httparchive.org into production
2 parents 5e8aba5 + f661a30 commit 4538b65

85 files changed

Lines changed: 2688 additions & 194 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
CREATE TEMP FUNCTION HAS_NO_STORE_DIRECTIVE(cache_control STRING) RETURNS BOOL AS (
2+
REGEXP_CONTAINS(cache_control, r'(?i)\bno-store\b')
3+
);
4+
5+
WITH requests AS (
6+
SELECT
7+
client,
8+
LOGICAL_OR(HAS_NO_STORE_DIRECTIVE(JSON_VALUE(payload, '$._cacheControl'))) AS includes_ccns
9+
FROM
10+
`httparchive.all.requests`
11+
WHERE
12+
date = '2023-10-01' AND
13+
is_main_document
14+
GROUP BY
15+
client,
16+
page
17+
)
18+
19+
SELECT
20+
client,
21+
COUNTIF(includes_ccns) AS pages,
22+
COUNT(0) AS total,
23+
COUNTIF(includes_ccns) / COUNT(0) AS pct
24+
FROM
25+
requests
26+
GROUP BY
27+
client
28+
ORDER BY
29+
client
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
WITH lh AS (
2+
SELECT
3+
client,
4+
page,
5+
rank,
6+
JSON_VALUE(lighthouse, '$.audits.no-unload-listeners.score') = '0' AS has_unload
7+
FROM
8+
`httparchive.all.pages`
9+
WHERE
10+
date = '2023-10-01' AND
11+
is_root_page
12+
)
13+
14+
15+
SELECT
16+
client,
17+
_rank AS rank,
18+
COUNTIF(has_unload) AS pages,
19+
COUNT(0) AS total,
20+
COUNTIF(has_unload) / COUNT(0) AS pct
21+
FROM
22+
lh,
23+
UNNEST([1000, 10000, 100000, 1000000, 10000000, 100000000]) AS _rank
24+
WHERE
25+
rank <= _rank
26+
GROUP BY
27+
client,
28+
rank
29+
ORDER BY
30+
rank,
31+
client
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
WITH lh AS (
2+
SELECT
3+
client,
4+
ARRAY_LENGTH(JSON_QUERY_ARRAY(lighthouse, '$.audits.non-composited-animations.details.items')) AS num_animations
5+
FROM
6+
`httparchive.all.pages`
7+
WHERE
8+
date = '2023-10-01' AND
9+
is_root_page
10+
)
11+
12+
13+
SELECT
14+
percentile,
15+
client,
16+
APPROX_QUANTILES(num_animations, 1000)[OFFSET(percentile * 10)] AS num_animations,
17+
COUNTIF(num_animations > 0) AS pages,
18+
COUNT(0) AS total,
19+
COUNTIF(num_animations > 0) / COUNT(0) AS pct
20+
FROM
21+
lh,
22+
UNNEST([10, 25, 50, 75, 90, 100]) AS percentile
23+
GROUP BY
24+
percentile,
25+
client
26+
ORDER BY
27+
percentile,
28+
client
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
WITH lh AS (
2+
SELECT
3+
client,
4+
CAST(JSON_VALUE(unsized_image, '$.node.boundingRect.height') AS INT64) AS height
5+
FROM
6+
`httparchive.all.pages`,
7+
UNNEST(JSON_QUERY_ARRAY(lighthouse, '$.audits.unsized-images.details.items')) AS unsized_image
8+
WHERE
9+
date = '2023-10-01' AND
10+
is_root_page
11+
)
12+
13+
14+
SELECT
15+
percentile,
16+
client,
17+
APPROX_QUANTILES(height, 1000)[OFFSET(percentile * 10)] AS height,
18+
COUNT(0) AS unsized_images
19+
FROM
20+
lh,
21+
UNNEST([10, 25, 50, 75, 90, 100]) AS percentile
22+
GROUP BY
23+
percentile,
24+
client
25+
ORDER BY
26+
percentile,
27+
client
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
WITH lh AS (
2+
SELECT
3+
client,
4+
ARRAY_LENGTH(JSON_QUERY_ARRAY(lighthouse, '$.audits.unsized-images.details.items')) AS num_unsized_images
5+
FROM
6+
`httparchive.all.pages`
7+
WHERE
8+
date = '2023-10-01' AND
9+
is_root_page
10+
)
11+
12+
13+
SELECT
14+
percentile,
15+
client,
16+
APPROX_QUANTILES(num_unsized_images, 1000)[OFFSET(percentile * 10)] AS num_unsized_images,
17+
COUNTIF(num_unsized_images > 0) AS pages,
18+
COUNT(0) AS total,
19+
COUNTIF(num_unsized_images > 0) / COUNT(0) AS pct
20+
FROM
21+
lh,
22+
UNNEST([10, 25, 50, 75, 90, 100]) AS percentile
23+
GROUP BY
24+
percentile,
25+
client
26+
ORDER BY
27+
percentile,
28+
client
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
WITH long_tasks AS (
2+
SELECT
3+
client,
4+
page,
5+
ANY_VALUE(httparchive.core_web_vitals.GET_CRUX_INP(payload)) AS inp,
6+
SUM(CAST(JSON_QUERY(item, '$.duration') AS FLOAT64)) AS long_tasks
7+
FROM
8+
`httparchive.all.pages`,
9+
UNNEST(JSON_QUERY_ARRAY(lighthouse, '$.audits.long-tasks.details.items')) AS item
10+
WHERE
11+
date = '2023-10-01' AND
12+
is_root_page
13+
GROUP BY
14+
client,
15+
page
16+
),
17+
18+
meta AS (
19+
SELECT
20+
*,
21+
COUNT(0) OVER (PARTITION BY client) AS n,
22+
ROW_NUMBER() OVER (PARTITION BY client ORDER BY inp) AS row
23+
FROM
24+
long_tasks
25+
WHERE
26+
inp IS NOT NULL
27+
)
28+
29+
SELECT
30+
client,
31+
long_tasks,
32+
inp
33+
FROM
34+
meta
35+
WHERE
36+
MOD(row, CAST(FLOOR(n / 1000) AS INT64)) = 0

sql/2023/performance/inp_tbt.sql

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
SELECT
2+
percentile,
3+
client,
4+
APPROX_QUANTILES(CAST(JSON_QUERY(lighthouse, '$.audits.total-blocking-time.numericValue') AS FLOAT64), 1000)[OFFSET(percentile * 10)] AS tbt
5+
FROM
6+
`httparchive.all.pages`,
7+
UNNEST([10, 25, 50, 75, 90, 100]) AS percentile
8+
WHERE
9+
date = '2023-10-01' AND
10+
is_root_page
11+
GROUP BY
12+
percentile,
13+
client
14+
ORDER BY
15+
percentile,
16+
client
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
SELECT
2+
IF(_rank < 100000000, CAST(_rank AS STRING), 'all') AS rank,
3+
client,
4+
APPROX_QUANTILES(CAST(JSON_VALUE(summary, '$.bytesJS') AS INT64), 1000)[OFFSET(500)] / 1024 AS js_kbytes
5+
FROM
6+
`httparchive.all.pages`,
7+
UNNEST([1000, 10000, 100000, 1000000, 10000000, 100000000]) AS _rank
8+
WHERE
9+
date = '2023-10-01' AND
10+
is_root_page AND
11+
rank <= _rank
12+
GROUP BY
13+
rank,
14+
client
15+
ORDER BY
16+
rank,
17+
client
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
WITH pages AS (
2+
SELECT
3+
client,
4+
page,
5+
JSON_VALUE(custom_metrics, '$.performance.lcp_elem_stats.url') AS url
6+
FROM
7+
`httparchive.all.pages`
8+
WHERE
9+
date = '2023-10-01' AND
10+
is_root_page
11+
),
12+
13+
requests AS (
14+
SELECT
15+
client,
16+
page,
17+
url,
18+
CAST(JSON_VALUE(summary, '$.respSize') AS INT64) / 1024 AS kbytes
19+
FROM
20+
`httparchive.all.requests`
21+
WHERE
22+
date = '2023-10-01' AND
23+
is_root_page
24+
)
25+
26+
SELECT
27+
percentile,
28+
client,
29+
APPROX_QUANTILES(kbytes, 1000)[OFFSET(percentile * 10)] AS kbytes
30+
FROM
31+
pages
32+
JOIN
33+
requests
34+
USING
35+
(client, page, url),
36+
UNNEST([10, 25, 50, 75, 90, 100]) AS percentile
37+
GROUP BY
38+
percentile,
39+
client
40+
ORDER BY
41+
percentile,
42+
client
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
WITH pages AS (
2+
SELECT
3+
client,
4+
page,
5+
JSON_VALUE(custom_metrics, '$.performance.lcp_elem_stats.url') AS url
6+
FROM
7+
`httparchive.all.pages`
8+
WHERE
9+
date = '2023-10-01' AND
10+
is_root_page
11+
),
12+
13+
requests AS (
14+
SELECT
15+
client,
16+
page,
17+
url,
18+
CAST(JSON_VALUE(summary, '$.respSize') AS INT64) / 1024 AS kbytes
19+
FROM
20+
`httparchive.all.requests`
21+
WHERE
22+
date = '2023-10-01' AND
23+
is_root_page
24+
)
25+
26+
SELECT
27+
client,
28+
IF(CEILING(kbytes / 100) * 100 < 1000, CAST(CEILING(kbytes / 100) * 100 AS STRING), '1000+') AS kbytes,
29+
COUNT(0) AS freq,
30+
SUM(COUNT(0)) OVER (PARTITION BY client) AS total,
31+
COUNT(0) / SUM(COUNT(0)) OVER (PARTITION BY client) AS pct
32+
FROM
33+
pages
34+
JOIN
35+
requests
36+
USING
37+
(client, page, url)
38+
GROUP BY
39+
client,
40+
kbytes
41+
ORDER BY
42+
client,
43+
kbytes

0 commit comments

Comments
 (0)